/* ===== CSS Variables & Reset ===== */
/* Airaa-inspired Design System — Atomic tokens */

/* Dark theme (default) */
:root, [data-theme="dark"] {
    --bg: #0c0c18;
    --bg-secondary: #131325;
    --bg-card: #1a1a30;
    --bg-input: #22223a;
    --bg-elevated: #1f1f38;
    --primary: #635bff;
    --primary-light: #7c75ff;
    --primary-subtle: rgba(99, 91, 255, 0.12);
    --accent: #34d399;
    --accent-hover: #2cc08a;
    --accent-subtle: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --danger-subtle: rgba(248, 113, 113, 0.1);
    --warning: #fbbf24;
    --text: #f0f2f5;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --text-dim: #4a5568;
    --border: rgba(255,255,255,0.06);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
    --nav-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --check-bg: transparent;
    --modal-overlay: rgba(0,0,0,0.6);
    color-scheme: dark;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-secondary: #eef0f4;
    --bg-card: #ffffff;
    --bg-input: #f0f2f5;
    --bg-elevated: #ffffff;
    --primary: #635bff;
    --primary-light: #4f46e5;
    --primary-subtle: rgba(99, 91, 255, 0.08);
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-subtle: rgba(16, 185, 129, 0.08);
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.06);
    --warning: #f59e0b;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;
    --border: rgba(0,0,0,0.06);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
    --shadow: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 6px 16px rgba(0,0,0,0.06);
    --check-bg: #f9fafb;
    --modal-overlay: rgba(0,0,0,0.25);
    color-scheme: light;
}

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

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

body {
    font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-optical-sizing: auto;
    font-variation-settings: 'wdth' 100;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    min-height: 100dvh;
}

/* ===== Typography ===== */
h1, h2, h3 {
    font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-optical-sizing: auto;
    font-variation-settings: 'wdth' 75;
    font-weight: 500;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: none;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .bottom-nav {
    box-shadow: 0 -2px 16px rgba(0,0,0,0.3);
    background: rgba(26, 26, 48, 0.92);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.65rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn.active { color: var(--primary-light); }
.nav-btn:hover { color: var(--text); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 91, 255, 0.3);
}
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(99, 91, 255, 0.35); }
.btn-primary:active { transform: scale(0.97); }

.btn-accent {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}
.btn-accent:hover { background: var(--accent-hover); }

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

.btn-ghost {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover { background: var(--bg-secondary); }

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    min-height: 40px;
}

.btn-block {
    width: 100%;
}

.btn-round {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.5rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    min-height: 48px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

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

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: none;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

/* ===== Screen Container ===== */
.screen {
    padding: 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.25s ease;
}

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

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 16px;
}

/* ===== Auth Screens ===== */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    position: relative;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.auth-toggle {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-toggle a {
    color: var(--primary-light);
    text-decoration: none;
    cursor: pointer;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: none;
}

/* ===== Dashboard ===== */

.start-workout-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.05rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(99, 91, 255, 0.3);
}

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

/* ===== Workout Cards (History/Dashboard) ===== */
.workout-card {
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s;
}

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

.workout-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.workout-card-name {
    font-weight: 600;
    font-size: 1rem;
}

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

.workout-card-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Active Workout Screen ===== */
.workout-timer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 8px 0;
}

.workout-timer span {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.1rem;
    color: var(--accent);
}

.workout-name-input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 700;
    width: 100%;
    padding: 4px 0;
}
.workout-name-input:focus {
    outline: none;
    border-bottom: 2px solid var(--primary);
}

/* Exercise block in active workout */
.exercise-block {
    margin-bottom: 20px;
}

.exercise-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.exercise-block-name {
    font-weight: 600;
    color: var(--primary-light);
    font-size: 0.95rem;
}

.exercise-block-muscle {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Sets table */
.sets-table {
    width: 100%;
    margin: 8px 0;
}

.sets-table-header {
    display: grid;
    grid-template-columns: 40px 1fr 1fr 48px 32px;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.set-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr 48px 32px;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.set-row.completed {
    background: rgba(34, 197, 94, 0.08);
}

.set-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.set-input {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 0.95rem;
    text-align: center;
    min-height: 40px;
    -moz-appearance: textfield;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
}

.set-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.set-check {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--check-bg);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.set-check.checked {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 2px 6px rgba(52, 211, 153, 0.3);
}

.set-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}
.set-delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.add-set-btn {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Workout action bar */
.workout-actions {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    z-index: 90;
}

.workout-actions .btn {
    flex: 1;
}

/* ===== Exercise Picker Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.15s ease;
}

.modal-sheet {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    max-height: 85dvh;
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-input);
    color: var(--text);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--bg-secondary);
}

.modal-body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.exercise-search {
    position: sticky;
    top: 0;
    background: var(--bg);
    padding-bottom: 12px;
    z-index: 1;
}

.muscle-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.muscle-filter::-webkit-scrollbar { display: none; }

.muscle-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.muscle-chip.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(99, 91, 255, 0.25);
}

.exercise-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.exercise-list-item:hover { background: var(--bg-input); }
.exercise-list-item:active { background: var(--bg-input); }

.exercise-list-name {
    font-weight: 500;
}

.exercise-list-muscle {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ===== History Screen ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workout-detail-exercises {
    margin-top: 12px;
}

.detail-exercise {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-exercise-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.detail-set-line {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 2px 0;
}

/* ===== Progress Screen ===== */
.pr-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.pr-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    cursor: pointer;
}

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

.pr-name { font-weight: 600; font-size: 0.9rem; }
.pr-muscle { font-size: 0.75rem; color: var(--text-dim); }
.pr-value { font-weight: 700; color: var(--accent); }
.pr-label { font-size: 0.7rem; color: var(--text-muted); }

.chart-container {
    margin-top: 16px;
    padding: 16px;
    height: 250px;
}

/* ===== Rest Timer ===== */
.rest-timer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.rest-timer-display {
    font-size: 4rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--accent);
}

.rest-timer-label {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.rest-presets {
    display: flex;
    gap: 12px;
}

.rest-preset-btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.rest-preset-btn.active {
    border: none;
    background: var(--accent-subtle);
    color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-dim);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 80px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== Desktop tweaks ===== */
@media (min-width: 768px) {
    .screen { padding: 24px; }
    .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
}

/* Smooth transition when switching themes */
[data-theme] * {
    transition: background-color 0.25s ease, color 0.15s ease, border-color 0.25s ease;
}

/* Light theme specific overrides */
[data-theme="light"] .start-workout-btn {
    background: linear-gradient(135deg, #635bff, #4f46e5);
}

[data-theme="light"] .set-check {
    background: var(--check-bg);
}

[data-theme="light"] .modal-overlay {
    background: var(--modal-overlay);
}

[data-theme="light"] .rest-timer-overlay {
    background: rgba(0,0,0,0.7);
}

[data-theme="light"] .card {
    box-shadow: var(--shadow);
}

[data-theme="light"] .bottom-nav {
    box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
}

/* ===== Exercise Media ===== */
.exercise-media {
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
    background: var(--bg-input);
}

.exercise-media img,
.exercise-media video {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm);
}

.exercise-media-placeholder {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

/* ===== Play/Pause CTA ===== */
.exercise-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-md);
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.exercise-play-btn:hover {
    background: rgba(99, 91, 255, 0.15);
}

.exercise-play-btn.playing {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.exercise-play-btn.done {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}

/* Exercise timer display */
.exercise-timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0;
}

/* ===== Complete Workout Button ===== */
.complete-workout-bar {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    left: 0;
    right: 0;
    background: var(--accent);
    padding: 16px;
    z-index: 95;
    animation: slideUp 0.3s ease;
    text-align: center;
}

.complete-workout-btn {
    width: 100%;
    max-width: 600px;
    padding: 16px 24px;
    background: white;
    color: var(--accent);
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 52px;
    transition: transform 0.15s;
}

.complete-workout-btn:active {
    transform: scale(0.97);
}

/* ===== Admin Panel ===== */
.admin-exercise-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
}

.admin-exercise-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.admin-exercise-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-upload-btn {
    position: relative;
    overflow: hidden;
}

.admin-upload-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.admin-badge {
    display: inline-block;
    font-size: 0.65rem;
    background: var(--danger);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ===== Routine Day Play Icon Button ===== */
.rd-play-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary-subtle);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.rd-play-icon-btn:hover {
    background: rgba(99, 91, 255, 0.18);
    box-shadow: 0 2px 8px rgba(99, 91, 255, 0.2);
}

.rd-play-icon-btn.playing {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* ===== Extracted Inline Styles ===== */

/* Auth */
.auth-theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
}

/* Dashboard */
.dashboard-subtitle {
    font-size: 0.85rem;
}

/* Workout Detail */
.delete-workout-btn-style {
    color: var(--danger);
}

.heading-tight {
    margin-bottom: 4px;
}

.subtext-spaced {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.chart-placeholder {
    padding: 24px;
}

/* Routine/Workout Cards */
.card-spaced {
    margin-bottom: 12px;
}

.workout-card-stats-spaced {
    margin-top: 6px;
}

.routine-description {
    font-size: 0.8rem;
    margin-top: 8px;
    white-space: pre-line;
}

/* Routine Detail */
.routine-subtitle-wrap {
    margin-bottom: 20px;
}

.routine-subtitle {
    font-size: 0.85rem;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.routine-subtitle.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.routine-subtitle-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 2px;
}

.block-label-container {
    margin: 20px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-label-title {
    font-size: 1rem;
}

.week-card {
    margin-bottom: 16px;
    padding: 12px;
}

.week-title {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.week-days-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.routine-day-btn-style {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    height: auto;
    text-align: left;
}

.day-number-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.day-name-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.day-exercises-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Routine Day Screen */
.screen-padded-bottom {
    padding-bottom: 80px;
}

.heading-tight-sm {
    margin-bottom: 2px;
}

.rd-add-set-spacing {
    margin-top: 4px;
}

/* In-Progress Workout */
.workout-ip-card {
    padding: 20px;
    text-align: center;
}

.workout-ip-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.workout-ip-stats {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.workout-ip-started {
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.flex-center {
    justify-content: center;
}

/* Active Workout */
.screen-workout-active {
    padding-bottom: 200px;
}

.discard-workout-btn-style {
    flex: 0;
    padding: 12px;
}

.start-workout-spacing {
    margin-bottom: 24px;
}

.programme-hint {
    font-size: 0.85rem;
}

.empty-state-compact {
    padding: 24px;
}

/* Complete Workout Bar (inline override) */
.complete-workout-bar-inline {
    position: relative;
    margin-top: 24px;
    border-radius: var(--radius);
}

.complete-workout-message {
    color: white;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Exercise Picker */
.picker-create-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
}

.picker-name-input {
    flex: 2;
}

.picker-group-select {
    flex: 1;
}

.picker-empty {
    padding: 24px;
}

.picker-thumb-icon {
    font-size: 1.5rem;
}

.picker-thumb-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.picker-add-icon {
    color: var(--primary-light);
    font-size: 1.2rem;
}

/* Admin Panel */
.admin-hint {
    font-size: 0.85rem;
}

.admin-thumb-placeholder {
    color: var(--text-dim);
    font-size: 1.2rem;
}

.admin-exercise-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ===== Material Symbols ===== */
.material-symbols-sharp {
    font-family: 'Material Symbols Sharp';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

/* ===== Day Screen (Figma) ===== */
.day-screen {
    background: var(--bg);
    min-height: 100dvh;
    padding: 24px 16px 32px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
}

.day-header {
    margin-top: 12px;
    margin-bottom: 16px;
}

.day-header-subtitle {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #555f71;
    margin-bottom: 4px;
}

[data-theme="dark"] .day-header-subtitle {
    color: var(--text-muted);
}

.day-header-title {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-variation-settings: 'wdth' 75;
    font-size: 24px;
    color: #101729;
    margin: 0;
}

[data-theme="dark"] .day-header-title {
    color: var(--text);
}

/* Exercise Card */
.day-ex-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

[data-theme="dark"] .day-ex-card {
    background: var(--bg-card);
}

.day-ex-card.completed {
    box-shadow: 0 0 0 1.5px var(--accent), var(--shadow);
    background: rgba(52, 211, 153, 0.04);
}

[data-theme="dark"] .day-ex-card.completed {
    background: rgba(52, 211, 153, 0.06);
}

.day-ex-card-header {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-bottom: 8px;
}

.day-ex-card-info {
    flex: 1;
    min-width: 0;
}

.day-ex-card-name {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: black;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .day-ex-card-name {
    color: var(--text);
}

.day-ex-card-meta {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #565656;
}

[data-theme="dark"] .day-ex-card-meta {
    color: var(--text-muted);
}

/* Play/Replay button */
.day-ex-play-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 6px rgba(99, 91, 255, 0.3);
}

.day-ex-play-btn:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 10px rgba(99, 91, 255, 0.35);
}

.day-ex-play-btn .material-symbols-sharp {
    font-size: 20px;
    color: white;
    font-weight: 600;
    text-align: center;
    font-variation-settings: 'FILL' 1;
}

.day-ex-play-btn.done-btn {
    background: var(--accent);
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(52, 211, 153, 0.3);
}

/* Media area */
.day-ex-media {
    width: 100%;
    aspect-ratio: 720 / 452;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-input);
    margin-bottom: 4px;
}

.day-ex-media img,
.day-ex-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.day-ex-media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Bottom status row */
.day-ex-status {
    display: flex;
    gap: 4px;
    align-items: center;
    white-space: nowrap;
}

.day-ex-status-icon {
    font-size: 14px;
    text-align: center;
}

.day-ex-status-icon.done {
    color: #19a750;
    font-weight: 600;
}

.day-ex-status-icon.pending {
    color: #565656;
}

[data-theme="dark"] .day-ex-status-icon.pending {
    color: var(--text-dim);
}

.day-ex-status-text {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 400;
    font-size: 10px;
    color: #565656;
}

[data-theme="dark"] .day-ex-status-text {
    color: var(--text-muted);
}

/* Expanded section inside card */
.day-ex-expanded {
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 12px;
}

[data-theme="dark"] .day-ex-expanded {
    border-top-color: rgba(255,255,255,0.06);
}

.day-ex-timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.day-ex-timer-value {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

/* ===== Routine Day Completion States ===== */
.routine-day-done {
    background: var(--accent-subtle) !important;
    box-shadow: 0 0 0 1.5px var(--accent) !important;
}

.day-done-check {
    font-size: 12px;
    color: var(--accent);
    vertical-align: middle;
}

.week-card-done {
    box-shadow: 0 0 0 1.5px var(--accent), var(--shadow);
    background: rgba(52, 211, 153, 0.03);
}

[data-theme="dark"] .week-card-done {
    background: rgba(52, 211, 153, 0.06);
}

.week-done-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.week-done-icon {
    font-size: 16px;
    color: var(--accent);
}

/* ===== Dashboard Progress Widgets ===== */
.progress-widgets {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.progress-widget {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-ring-container {
    position: relative;
    flex-shrink: 0;
}

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

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-input);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.progress-ring-fill.ring-primary { stroke: var(--primary-light); }
.progress-ring-fill.ring-accent { stroke: var(--accent); }
.progress-ring-fill.ring-amber { stroke: #f59e0b; }

.progress-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

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

.progress-widget-title {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-variation-settings: 'wdth' 75;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
}

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

.progress-widget-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-widget-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-widget-bar-fill.bar-primary { background: var(--primary-light); }
.progress-widget-bar-fill.bar-accent { background: var(--accent); }
.progress-widget-bar-fill.bar-amber { background: #f59e0b; }

.progress-widget-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
}

.progress-widget-icon.icon-primary { background: rgba(99, 102, 241, 0.12); }
.progress-widget-icon.icon-accent { background: rgba(34, 197, 94, 0.12); }
.progress-widget-icon.icon-amber { background: rgba(245, 158, 11, 0.12); }

/* ===== Programme Card (Figma) ===== */
.programme-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

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

.programme-card:hover {
    box-shadow: var(--shadow-lg);
}

.programme-card-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.programme-card-badge-number {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 500;
    font-size: 24px;
    color: white;
    text-align: center;
    line-height: 1;
}

.programme-card-title {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-variation-settings: 'wdth' 75;
    font-size: 18px;
    color: var(--text);
    line-height: 1.2;
}

.programme-card-meta {
    display: flex;
    gap: 16px;
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.programme-card-desc {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== Unified Back Button (Figma) ===== */
.back-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(74, 85, 104, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 7px 8px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: rgba(74, 85, 104, 0.18);
}

.back-btn:active {
    background: rgba(74, 85, 104, 0.25);
}

.back-btn .material-symbols-sharp {
    font-size: 14px;
    color: #4a5568;
    font-weight: 400;
}

[data-theme="dark"] .back-btn {
    background: rgba(160, 174, 192, 0.1);
}

[data-theme="dark"] .back-btn:hover {
    background: rgba(160, 174, 192, 0.18);
}

[data-theme="dark"] .back-btn .material-symbols-sharp {
    color: #a0aec0;
}

/* ===== Day Completed Badge ===== */
.day-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.day-completed-icon {
    font-size: 16px;
    font-variation-settings: 'FILL' 1;
}

/* ===== History — Exercise Level ===== */
.history-date-header {
    font-family: 'Google Sans Flex', sans-serif;
    font-weight: 600;
    font-variation-settings: 'wdth' 75;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 16px 0 8px;
}

.history-exercise-card {
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

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

.history-ex-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.history-ex-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-ex-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.history-ex-stats {
    text-align: center;
    min-width: 40px;
}

.history-ex-stat-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
}

.history-ex-unit {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-dim);
}

.history-ex-stat-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 1px;
}
