/* CSS Variables for consistent theming */
:root {
    /* Neutral charcoal/zinc palette */
    --background-dark: #0a0a0b;
    --surface-dark: #141416;
    --surface-elevated: #1c1c1f;
    --surface-hover: #232327;
    --border-color: #2a2a2e;
    --border-light: #35353b;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #6b6b73;

    /* Single restrained accent + light "action" color */
    --primary-color: #fafafa;
    --primary-dark: #d4d4d8;
    --on-primary: #0a0a0b;
    --secondary-color: #232327;
    --accent-color: #d4d4d8;

    --success-color: #34d399;
    --error-color: #f87171;

    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --border-radius: 14px;
    --transition: all 0.18s ease;
}

:root[data-theme="light"] {
    --background-dark: #f4f4f5;
    --surface-dark: #ffffff;
    --surface-elevated: #ffffff;
    --surface-hover: #f0f0f2;
    --border-color: #e4e4e7;
    --border-light: #d4d4d8;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-tertiary: #a1a1aa;

    --primary-color: #18181b;
    --primary-dark: #000000;
    --on-primary: #fafafa;
    --accent-color: #3f3f46;

    --success-color: #059669;
    --error-color: #dc2626;

    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] body {
    color-scheme: light;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    color-scheme: dark;
}

/* App container */
#app {
    min-height: 100vh;
    position: relative;
}

/* Screen management */
.screen {
    display: none;
    min-height: 100vh;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.motivational-quote {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 340px;
    line-height: 1.5;
}

/* Main menu header */
.main-header {
    margin-bottom: 32px;
    padding-top: 8px;
}

.main-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--text-primary);
    color: var(--on-primary);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
}

.brand-mark-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.85rem;
}

/* Section label */
.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 14px;
}

/* Auth screen */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    gap: 36px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.auth-brand h1 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.auth-brand p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: -8px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-dark);
    border-radius: 20px;
    padding: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: var(--background-dark);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 11px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#auth-form input {
    width: 100%;
    padding: 13px 16px;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

#auth-form input::placeholder {
    color: var(--text-tertiary);
}

#auth-form input:focus {
    border-color: var(--border-light);
    background: var(--surface-dark);
}

.btn-full {
    width: 100%;
    margin-top: 6px;
}

.auth-error {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--error-color);
    text-align: center;
    min-height: 20px;
}

/* Account avatar + dropdown */
.avatar-menu {
    position: relative;
}

.avatar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    padding: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    box-shadow: var(--shadow);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-item {
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--surface-hover);
}

/* Profile screen */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
}

.profile-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    transition: var(--transition);
}

.profile-avatar:hover {
    border-color: var(--border-light);
}

.avatar-edit-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 0;
    text-align: center;
}

.profile-hero-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.profile-hero-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 32px;
}

.profile-form .section-label {
    margin-top: 8px;
    margin-bottom: 0;
}

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

.profile-form input,
.profile-form select,
.weight-log-input input {
    width: 100%;
    padding: 13px 16px;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.profile-form input:focus,
.profile-form select:focus,
.weight-log-input input:focus {
    border-color: var(--border-light);
}

.weight-log-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.weight-log-input input {
    flex: 1;
}

.weight-log-input .btn {
    min-width: auto;
    padding: 13px 24px;
}

/* Weight chart — always show values */
#weight-chart {
    margin-bottom: 24px;
}

#weight-chart .bar-value {
    opacity: 1;
}

/* Workout timer styles */
.workout-timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--surface-dark);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.timer-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.timer-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

/* Last workout styles */
#last-workout-container {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    border-left: 4px solid var(--accent-color);
}

.last-workout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.last-workout-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.last-workout-duration {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
}

.last-workout-exercises {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.last-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
}

.last-exercise-name {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
}

.last-exercise-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    text-align: right;
}

.last-set-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--surface-dark);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.no-last-workout {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
    margin: 0;
}

/* Program grid */
.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 36px;
}

.program-btn {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 104px;
    justify-content: space-between;
    text-align: left;
    position: relative;
}

.program-btn:hover {
    border-color: var(--border-light);
    background: var(--surface-elevated);
    transform: translateY(-2px);
}

.program-btn .program-cat {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.program-btn .name {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Bottom navigation */
.bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: auto;
    padding: 4px 0 20px;
}

.nav-btn {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-btn:hover {
    background: var(--surface-elevated);
    border-color: var(--border-light);
}

/* Back button */
.back-btn {
    position: absolute;
    left: 0;
    top: 20px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.back-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Workout form */
.workout-form {
    max-width: 600px;
    margin: 0 auto;
}

.exercise-entry {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.exercise-entry:hover {
    border-color: var(--primary-color);
}

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

.exercise-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.remove-exercise-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-exercise-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
}

/* Add exercise */
.add-exercise-wrap {
    margin-top: 4px;
    margin-bottom: 8px;
}

.add-exercise-btn {
    width: 100%;
    padding: 14px;
    border: 1px dashed var(--border-light);
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.add-exercise-btn:hover {
    background: var(--surface-elevated);
    border-style: solid;
    color: var(--text-primary);
}

/* Exercise picker modal */
.picker-modal {
    max-width: 420px;
}

.picker-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

.picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 14px;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.picker-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.picker-chevron {
    color: var(--text-tertiary);
    font-size: 1.1rem;
}

.picker-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 24px 0;
}

/* Sets container styling */
.sets-container {
    margin-bottom: 16px;
}

.set-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 60px;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.set-row:last-child {
    border-bottom: none;
}

.set-row.set-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 8px;
}

.set-row.set-header .set-weight,
.set-row.set-header .set-reps {
    padding-left: 13px;
}

.set-number {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.set-weight,
.set-reps {
    display: flex;
    flex-direction: column;
}

.set-weight input,
.set-reps input {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
}

.set-weight input:focus,
.set-reps input:focus {
    outline: none;
    border-color: var(--border-light);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.set-actions {
    display: flex;
    justify-content: center;
}

.btn-remove-set {
    background: var(--error-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.btn-remove-set:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Exercise actions */
.exercise-actions {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.add-set-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-light);
    border-radius: 10px;
    padding: 11px 24px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: auto;
}

.add-set-btn:hover {
    background: var(--surface-elevated);
    border-style: solid;
    color: var(--text-primary);
}

/* Form actions */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

.btn {
    padding: 15px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.99);
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

/* History and Progress screens */
.history-filters,
.progress-filters {
    margin-bottom: 24px;
}

.history-filters select,
.progress-filters select {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
}

.workout-card {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.workout-card:hover {
    border-color: var(--primary-color);
}

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

.workout-program {
    font-weight: 600;
    color: var(--primary-color);
}

.workout-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.workout-duration {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--background-dark);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.duration-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.duration-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
}

.workout-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-delete-workout {
    background: var(--error-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.btn-delete-workout:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.exercise-item:last-child {
    border-bottom: none;
}

.exercise-item-name {
    font-weight: 500;
    min-width: 120px;
}

.exercise-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    text-align: right;
}

.set-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Rest Timer Styles */
.rest-timer-container {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
    border-left: 4px solid var(--accent-color);
}

.rest-timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.rest-timer-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
}

.rest-timer-controls select {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.rest-timer-display {
    margin-bottom: 20px;
}

.rest-timer-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--background-dark);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rest-timer-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) 0deg, transparent 0deg);
    transition: background 0.1s ease;
}

.rest-timer-time {
    position: relative;
    z-index: 2;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.rest-timer-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.rest-timer-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: auto;
}

/* Rest timer states */
.rest-timer-container.active {
    border-left-color: var(--text-primary);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.05);
}

.rest-timer-container.completed {
    border-left-color: var(--success-color);
}

/* Progress chart styles */
#progress-chart {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    min-height: 300px;
}

/* Progress placeholder */
.progress-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    min-height: 200px;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.progress-placeholder h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.progress-placeholder p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Progress container */
.progress-container {
    width: 100%;
}

.progress-header {
    margin-bottom: 24px;
}

.exercise-title {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 16px;
    text-align: center;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.positive {
    color: var(--success-color);
}

.stat-value.neutral {
    color: var(--text-secondary);
}

/* Chart container */
.chart-container {
    margin-bottom: 24px;
}

.chart-bars {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 8px;
    height: 200px;
    padding: 0 8px;
    position: relative;
}

.chart-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 4px;
    border-radius: 8px;
    min-width: 0;
    position: relative;
}

.chart-bar-container:hover,
.chart-bar-container.active {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}

.chart-bar-container.touching {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.98);
}

.chart-bar {
    background: linear-gradient(to top, #52525b, var(--text-primary));
    border-radius: 4px 4px 0 0;
    width: 100%;
    min-height: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-bar:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bar-value {
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: -20px;
    white-space: nowrap;
    background: var(--surface-dark);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: var(--transition);
}

.chart-bar-container:hover .bar-value,
.chart-bar-container.active .bar-value {
    opacity: 1;
}

.bar-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
}

.bar-details {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-top: 8px;
    box-shadow: var(--shadow);
    z-index: 10;
    display: none;
    min-width: 200px;
    text-align: center;
}

.bar-sets {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Progress summary */
.progress-summary {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 480px) {
    .screen {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .program-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .program-btn {
        align-items: center;
        text-align: center;
        min-height: 80px;
        padding: 16px;
        gap: 6px;
    }
    
    .set-row {
        grid-template-columns: 50px 1fr 1fr 50px;
        gap: 8px;
    }
    
    .set-weight input,
    .set-reps input {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .btn {
        min-width: 100%;
    }
    
    .exercise-item {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .exercise-sets {
        text-align: left;
    }
    
    .workout-actions {
        flex-direction: column;
        gap: 8px;
        align-items: flex-end;
    }
    
    .last-workout-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .last-exercise-item {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .last-exercise-sets {
        text-align: left;
    }
    
    .btn-delete-workout {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    /* Progress chart mobile improvements */
    .progress-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .chart-bars {
        height: 180px;
        gap: 6px;
        padding: 0 4px;
    }
    
    .chart-bar-container {
        padding: 6px 2px;
        min-width: 0;
    }
    
    .bar-value {
        font-size: 0.6rem;
        padding: 1px 4px;
        top: -18px;
    }
    
    .bar-date {
        font-size: 0.6rem;
        margin-top: 6px;
    }
    
    .bar-details {
        min-width: 150px;
        padding: 8px;
        font-size: 0.7rem;
    }
    
    .progress-summary {
        padding: 12px;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .summary-label,
    .summary-value {
        font-size: 0.8rem;
    }
    
    /* Rest timer mobile styles */
    .rest-timer-container {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    .rest-timer-header {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .rest-timer-circle {
        width: 100px;
        height: 100px;
    }
    
    .rest-timer-time {
        font-size: 1.2rem;
    }
    
    .rest-timer-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .rest-timer-actions .btn {
        width: 100%;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error states */
.success {
    border-color: var(--success-color) !important;
}

.error {
    border-color: var(--error-color) !important;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Confirm modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.visible {
    opacity: 1;
}

.modal {
    width: 100%;
    max-width: 380px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease;
}

.modal-overlay.visible .modal {
    transform: translateY(0) scale(1);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.modal-message {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
}

.modal-cancel {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-cancel:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Settings screen */
.settings-section {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section .section-label {
    margin-bottom: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-row > span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.theme-toggle {
    display: flex;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
}

.theme-option {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-option.active {
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

#password-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#password-form input {
    width: 100%;
    padding: 13px 16px;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

#password-form input:focus {
    border-color: var(--border-light);
}

/* ─── Progress line chart ─────────────────────────────── */

.line-chart-wrap {
    margin: 20px 0 8px;
    overflow: hidden;
}

.line-chart-svg {
    width: 100%;
    display: block;
    overflow: visible;
}

.lc-grid {
    stroke: var(--border-color);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.lc-line {
    stroke: var(--text-primary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lc-dot {
    fill: var(--surface-dark);
    stroke: var(--text-primary);
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.15s ease, r 0.15s ease;
}

.lc-dot:hover,
.lc-dot.active {
    fill: var(--text-primary);
}

.lc-ylabel {
    font-size: 9px;
    fill: var(--text-tertiary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.lc-date {
    font-size: 8px;
    fill: var(--text-tertiary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.lc-tooltip {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lc-tooltip-date {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.lc-tooltip-sets {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Friends ─────────────────────────────────────────── */

.req-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--error-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1;
}

.friends-search {
    margin-bottom: 28px;
}

.friends-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.friends-search-row .btn {
    min-width: unset;
    flex-shrink: 0;
}

.friends-search-row input {
    flex: 1;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.friends-search-row input:focus {
    border-color: var(--border-light);
}

.friend-search-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 6px 0;
}

.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    gap: 12px;
}

.friend-result-card {
    margin-top: 4px;
}

.friend-card-accepted {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
}

.friend-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-card-toggle {
    cursor: pointer;
    padding: 14px 16px;
    flex: 1;
}

.friend-card-toggle:hover .friend-name {
    color: var(--text-primary);
}

.friend-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.friend-chevron {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    transition: transform 0.18s ease;
    display: inline-block;
}

.friend-chevron.open {
    transform: rotate(90deg);
}

.friend-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-elevated);
    flex-shrink: 0;
}

.friend-avatar-default {
    color: var(--text-tertiary);
    background: var(--surface-elevated);
    padding: 4px;
}

.friend-card-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
}

.friend-card:not(.friend-card-accepted) .friend-card-actions {
    padding: 0;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    min-width: unset;
}

.friends-empty {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 32px 0;
}

.friend-workouts {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
}

.friend-workouts-loading,
.friend-workouts-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 4px 0;
}

.friend-workout-item {
    margin-bottom: 14px;
}

.friend-workout-item:last-child {
    margin-bottom: 0;
}

.friend-workout-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.friend-workout-program {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.friend-workout-date {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.friend-exercise-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 2px 0;
}

.friend-exercise-name {
    color: var(--text-secondary);
}

.friend-exercise-sets {
    color: var(--text-tertiary);
}

.settings-message {
    font-size: 0.85rem;
    color: var(--error-color);
    min-height: 18px;
}

.danger-zone {
    border-color: rgba(220, 38, 38, 0.35);
}

.danger-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Crop modal */
.crop-modal {
    max-width: 420px;
}

.crop-area {
    width: 100%;
    height: 320px;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--background-dark);
}

.crop-area img {
    display: block;
    max-width: 100%;
}

/* Round the crop selection to preview the avatar shape */
.crop-area .cropper-view-box,
.crop-area .cropper-face {
    border-radius: 50%;
}
