/* FitNotes v2 — Kinetic Mint design system */

/* === DESIGN TOKENS === */
:root {
    /* Surfaces — rich charcoal, not flat black */
    --bg: #0c0e10;
    --surface-1: #111416;
    --surface-2: #171a1d;
    --surface-3: #1d2023;
    --surface-4: #22262a;
    --surface-bright: #282d31;

    /* Text */
    --text-primary: #e3e6ea;
    --text-secondary: #a8abb0;
    --text-tertiary: #72767a;

    /* Accent — pink */
    --accent: #FFC2CB;
    --accent-dim: rgba(255, 194, 203, 0.15);
    --accent-strong: #dcffe5;
    --accent-muted: #a0e3b8;

    /* Pastels */
    --pastel-sky: #A3DDF6;
    --pastel-pink: #FFC2CB;
    --pastel-yellow: #FEE8AA;
    --pastel-mint: #B4F8CC;
    --pastel-lavender: #D6C5F7;

    /* Semantic */
    --positive: #30d158;
    --negative: #ff453a;
    --warning: #ff9f0a;
    --record: #ffd60a;

    /* Borders */
    --divider: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.12);
    --outline: #44484c;

    /* M3 tonal containers */
    --primary-container: #1e603f;
    --on-primary-container: #b3f7cb;
    --secondary-container: #002a36;
    --on-secondary-container: #a3ddf6;
    --tertiary-container: #4f426c;
    --on-tertiary-container: #d6c5f7;
    --error-container: #8a1a1e;
    --on-error-container: #ff9993;

    /* Typography — Space Grotesk everywhere */
    --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Spacing (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;

    /* Typography sizes */
    --font-display: 3rem;
    --font-headline: 2rem;
    --font-title: 1.375rem;
    --font-body: 1rem;
    --font-caption: 0.8125rem;
    --font-label: 0.75rem;

    --weight-display: 700;
    --weight-headline: 700;
    --weight-title: 600;
    --weight-body: 400;
    --weight-caption: 500;
    --weight-label: 600;

    --leading-display: 1.05;
    --leading-headline: 1.15;
    --leading-title: 1.25;
    --leading-body: 1.5;
    --leading-caption: 1.4;
    --leading-label: 1.3;

    --tracking-display: -0.035em;
    --tracking-headline: -0.015em;
    --tracking-title: -0.01em;
    --tracking-caption: 0.01em;
    --tracking-label: 0.02em;

    /* Shape — M3E expressive radii */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Elevation — dark-optimised */
    --elevation-1: 0 1px 3px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.04);
    --elevation-2: 0 4px 12px rgba(0,0,0,0.24), 0 0 0 1px rgba(255,255,255,0.05);
    --elevation-3: 0 8px 24px rgba(0,0,0,0.32), 0 0 0 1px rgba(255,255,255,0.06);
    --focus-glow: 0 0 0 3px rgba(180, 248, 204, 0.22);
    --hero-glow: 0 8px 24px rgba(180, 248, 204, 0.10);

    /* Motion */
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 350ms;
    --duration-enter: 400ms;
    --easing-standard: cubic-bezier(0.2, 0, 0, 1);
    --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* State layers */
    --state-hover: 0.08;
    --state-focus: 0.08;
    --state-pressed: 0.12;
    --state-dragged: 0.16;
    --opacity-disabled-content: 0.38;
    --opacity-disabled-container: 0.12;

    /* Layout */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-toast: 300;
    --icon-sm: 16px;
    --icon-md: 20px;
    --icon-lg: 24px;
    --icon-xl: 32px;
}


/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text-primary);
    height: 100dvh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
    font-size: var(--font-body);
    line-height: var(--leading-body);
}

/* === APP SHELL === */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
}

/* === HEADER === */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
    background: rgba(12,14,16,0.92);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid var(--divider);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}
.hamburger-btn .material-symbols-rounded { font-size: 24px; }
.hamburger-btn:active { background: rgba(255,255,255,0.08); transform: scale(0.95); }

/* Center toggle (workout <-> calendar) */
.header-center-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    transition: opacity 0.15s ease;
    width: 80px;
    height: 44px;
    border-radius: 22px;
    background: var(--surface-3);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-center-btn .material-symbols-rounded { font-size: 26px; }
.header-center-btn:active { transform: translate(-50%, -50%) scale(0.95); }
.header-center-btn.hidden { opacity: 0; pointer-events: none; }

.header-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.header-subtitle {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--accent);
    transition: background 0.3s;
}
.header-sync-dot.dirty { background: var(--pastel-yellow); width: 10px; height: 10px; animation: pulse 1.5s infinite; }
.header-sync-dot.syncing { background: var(--accent); animation: pulse 1s infinite; }

/* === CONTENT AREA === */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;

    padding-bottom: var(--space-4);
}

/* === BENTO MENU === */
.bento-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 220;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.bento-overlay.open {
    opacity: 1;
    visibility: visible;
}

.bento-panel {
    background: var(--surface-3);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 460px;
    max-height: calc(100dvh - max(56px, 44px + env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    overflow-y: auto;

    padding: var(--space-5) var(--space-5) var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: max(56px, 44px + env(safe-area-inset-top));
    box-shadow: var(--elevation-3);
    transform: scale(0.95) translateY(-8px);
    transition: transform var(--duration-enter) var(--easing-spring);
}
.bento-overlay.open .bento-panel {
    transform: scale(1) translateY(0);
}

.bento-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    flex-shrink: 0;
}
.bento-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.bento-profile-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
}
.bento-profile-name {
    font-weight: var(--weight-headline);
    font-size: var(--font-body);
}

/* Primary nav — full-width prominent button for Today's Workout */
.bento-primary-nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    border: 2px solid var(--border);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s ease;
    -webkit-appearance: none;
}
.bento-primary-nav:active { transform: scale(0.97); }
.bento-primary-nav.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.bento-section-label {
    font-size: var(--font-label);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0 4px;
    margin-top: 4px;
}

.bento-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-2);
}
.bento-nav.bento-nav-2x2 {
    grid-template-columns: 1fr 1fr;
}
.bento-nav-tile {
    background: var(--surface-1);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
    min-height: 72px;
    transition: transform 0.1s ease;
}
.bento-nav-tile:active { transform: scale(0.95); }
.bento-nav-tile.active {
    background: var(--accent-dim);
    color: var(--accent);
}
.bento-nav-icon { line-height: 1; }
.bento-nav-label {
    font-size: var(--font-label);
    font-weight: var(--weight-label);
}

.bento-overlay.open .bento-nav-tile {
    animation: bentoIn 0.3s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes bentoIn {
    from { opacity: 0; transform: scale(0.92) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.bento-nav-tile:nth-child(n) { animation-delay: 0.08s; }

.bento-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-3);
    border-radius: var(--radius-md);
}
.bento-settings-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-body);
    color: var(--text-primary);
}
.bento-settings-label .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--surface-4);
    border-radius: 9999px;
    border: 2px solid var(--border);
    transition: all 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
    cursor: pointer;
}
.toggle-track::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    background: var(--border);
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    transition: all 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track::after {
    background: var(--bg);
    left: 25px;
    width: 22px;
    height: 22px;
}

/* === PROFILE PICKER === */
.profile-picker {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
}

.profile-picker-title {
    font-size: var(--font-display);
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-family: var(--font-family);
}

.profile-picker-options {
    display: flex;
    gap: var(--space-5);
}

.profile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}
.profile-btn:active {
    transform: scale(0.95);
    border-color: var(--accent);
}

.profile-btn-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-title);
    font-weight: var(--weight-display);
    color: #fff;
}

.profile-btn-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.profile-btn-stat {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.profile-btn-stat-dim {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

/* === CARDS === */
.card {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    border: 1px solid var(--divider);
    margin: var(--space-2) var(--space-3);
    overflow: hidden;
    box-shadow: var(--elevation-1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
}

.card-body {
    padding: 0 var(--space-4) var(--space-3);
}

/* === EXERCISE CARD === */
.exercise-card {
    margin: var(--space-2) var(--space-3);
}

.exercise-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
}

.exercise-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.exercise-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.exercise-note {
    padding: var(--space-1) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    cursor: pointer;
}

/* === SET ROW === */
.set-row {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    transition: background 0.2s, opacity 0.2s;
    position: relative;
    border-radius: var(--radius-sm);
    margin: 0 var(--space-2);
}

.set-row.done,
.set-row.set-done {
    background: linear-gradient(135deg, rgba(180,248,204,0.08), rgba(180,248,204,0.03));
}
.set-row.done .set-check,
.set-row.set-done .set-check {
    background: var(--accent);
    color: var(--bg);
    box-shadow: inset 0 0 12px rgba(180,248,204,0.6), 0 0 15px rgba(180,248,204,0.3);
}
.set-row.done .set-input,
.set-row.set-done .set-input { color: var(--accent); }
.set-row.done .input-stepper,
.set-row.set-done .input-stepper { background: rgba(0,0,0,0.3); box-shadow: none; }


.set-row.deload {
    opacity: 0.5;
}


/* === STEPPER === */
.input-stepper {
    display: flex;
    align-items: center;
    flex: 1;
    background: var(--surface-1);
    border-radius: var(--radius-full);
    overflow: hidden;
    height: 44px;
    padding: 2px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.05);
}

.stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-4);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
    -webkit-appearance: none;
}
.stepper-btn.minus { }
.stepper-btn.plus { }
.stepper-btn:active { background: var(--accent); color: var(--bg); transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }

.set-input {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: center;
    padding: 12px 2px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    outline: none;
    min-width: 0;
    -moz-appearance: textfield;
}
.set-input:focus { outline: none; box-shadow: none; }
.set-input::-webkit-inner-spin-button,
.set-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* === CHECK BUTTON === */
.set-check {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    background: #0c0e10;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.05);
    transition: all 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
}
.set-check.checked {
    background: var(--accent);
    color: var(--bg);
    animation: checkPop 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes checkPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* === TAG === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    background: var(--surface-3);
    color: var(--text-secondary);
    white-space: nowrap;
}

.tag-accent {
    background: var(--accent-dim);
    color: var(--accent);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    -webkit-appearance: none;
    gap: var(--space-1);
    min-height: 44px;
}
.btn:active { transform: scale(0.97); }

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

.btn-secondary {
    background: var(--surface-3);
    color: var(--text-primary);
}

.btn-tonal {
    background: var(--accent-dim);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-block { width: 100%; }

.btn-danger {
    background: rgba(255,69,58,0.15);
    color: var(--negative);
}

/* === ICON BUTTON === */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    -webkit-appearance: none;
}
.icon-btn:active { background: var(--surface-3); }

/* === MODAL === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface-3);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 360px;
    max-height: 80dvh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--duration-normal) var(--easing-standard);
    box-shadow: var(--elevation-3);
}
.modal-backdrop.open .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
}

.modal-body {
    padding: var(--space-4);
}

/* === ACTION SHEET === */
.action-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.action-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.action-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: var(--elevation-3);
    z-index: 501;
    background: var(--surface-2);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    max-height: 70dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.action-sheet-backdrop.open .action-sheet {
    transform: translateY(0);
}

.action-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-4);
    margin: 0 auto var(--space-4);
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: var(--font-body);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    -webkit-appearance: none;
}
.action-sheet-item:active { background: var(--surface-3); }
.action-sheet-item.danger { color: var(--negative); }

.action-sheet-icon {
    font-size: 20px;
    color: var(--text-secondary);
}
.action-sheet-item.danger .action-sheet-icon { color: var(--negative); }

/* === DIALOG === */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 25dvh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.dialog-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.dialog {
    background: var(--surface-3);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    width: 280px;
    transform: scale(0.9);
    transition: transform var(--duration-normal) var(--easing-standard);
    box-shadow: var(--elevation-3);
}
.dialog-backdrop.open .dialog {
    transform: scale(1);
}

.dialog-msg {
    font-size: var(--font-body);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-4);
}

.dialog-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-family: inherit;
    outline: none;
    margin-bottom: var(--space-4);
}
.dialog-input:focus { border-color: var(--accent); box-shadow: var(--focus-glow); }

.dialog-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-bright);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    z-index: 700;
    opacity: 0;
    pointer-events: none;
    transition: all var(--duration-slow);
    white-space: nowrap;
    box-shadow: var(--elevation-2);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* === TIMER OVERLAY === */
.timer-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, background 0.3s ease;
}
.timer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.timer-display {
    font-size: 5rem;
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-family);
}

.timer-presets {
    display: flex;
    gap: var(--space-2);
}

.timer-preset {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.timer-preset.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}

.timer-start-btn {
    padding: var(--space-4) var(--space-10);
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--bg);
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    border: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.timer-start-btn:active { transform: scale(0.95); }

.timer-overlay.alarming { background: var(--negative); }
.timer-overlay.alarming .timer-display { color: #fff; }
.timer-overlay.alarming .timer-start-btn {
    background: #fff;
    color: var(--negative);
}

/* === TIMER PILL (header) === */
.header-timer-pill {
    display: none;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: var(--accent-dim);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    color: var(--accent);
    cursor: pointer;
}
.header-timer-pill.visible { display: flex; }
.header-timer-pill.pulse { animation: pulse 1s infinite; }

/* === CALENDAR === */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-4) var(--space-2);
}

.cal-month-label {
    font-size: 10px;
    font-weight: var(--weight-title);
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    -webkit-appearance: none;
    transition: background 0.15s;
}
.cal-nav-btn:active { background: var(--surface-4); }

.cal-today-btn {
    height: 36px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, var(--accent) 0%, #ffb0bc 100%);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-full);
    padding: 0 var(--space-4);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255,194,203,0.2);
    -webkit-appearance: none;
    transition: opacity 0.15s;
}
.cal-today-btn:active { opacity: 0.8; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
    overflow: hidden;
}
.cal-grid.slide-left { animation: slideLeft 150ms ease-out; }
.cal-grid.slide-right { animation: slideRight 150ms ease-out; }
@keyframes slideLeft { from { transform: translateX(40px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideRight { from { transform: translateX(-40px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }

.cal-day {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    gap: var(--space-2);
    background: linear-gradient(165deg, #171a1d 0%, #111315 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    border: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.cal-day:active {
    background: var(--surface-3);
}

.cal-day-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.cal-day-num {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.cal-day.today {
    color: var(--accent);
}
.cal-day.today .cal-day-name { color: var(--accent); }
.cal-day.today.selected { color: var(--bg); }
.cal-day.today.selected .cal-day-name { color: var(--bg); }

.cal-day.selected {
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 4px 20px rgba(180,248,204,0.15);
    transform: scale(1.05);
    z-index: 1;
}
.cal-day.selected .cal-day-name {
    color: var(--bg);
}
.cal-day.selected .cal-day-num {
    color: var(--bg);
}
.cal-day.selected .cal-tag {
    background: var(--bg) !important;
    color: var(--accent) !important;
}

.cal-day.has-workout {
    color: var(--text-primary);
    font-weight: var(--weight-caption);
}

.cal-day.record-day {
    box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--record) 40%, transparent);
}

.cal-tag {
    font-size: 16px;
    font-weight: 800;
    padding: 0;
    border-radius: 0;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: none !important;
}

.cal-rest-badge {
    font-size: 20px;
    padding: 4px 6px;
    border-radius: var(--radius-full);
    background: rgba(214,197,247,0.15);
    line-height: 1;
}

.cal-nav-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* === CALENDAR DAY DETAIL === */
.cal-detail {
    margin: var(--space-3);
    margin-top: var(--space-5);
    padding: var(--space-5);
    background: transparent;
    border-radius: var(--radius-lg);
    border: none;
}

.cal-detail-date {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    margin-bottom: var(--space-3);
}

.cal-type-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
}

.cal-detail-exercise {
    padding: var(--space-4) var(--space-4);
    background: linear-gradient(165deg, #171a1d 0%, #111315 100%);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}
.cal-detail-exercise:last-child { margin-bottom: 0; }

.cal-detail-name {
    font-size: var(--font-body);
    font-weight: 700;
    background: linear-gradient(180deg, #FFFFFF 0%, #A8ABB0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--space-1);
}

.cal-detail-sets {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

/* === ROUTINE BUTTON === */
.routine-btn {
    width: 100%;
    padding: 10px 14px 10px 10px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--bg);
    font-family: inherit;
    -webkit-appearance: none;
    box-shadow: 0 0 25px rgba(255,194,203,0.15);
    transition: transform 0.15s, box-shadow 0.15s;
}
.routine-btn:active { transform: scale(0.95); }

.routine-btn-block {
    width: 60px;
    height: 80px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transform: rotate(-90deg);
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.1), 0 3px 8px rgba(0,0,0,0.12);
}

.routine-btn-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.routine-btn-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.routine-btn-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a0a10;
    letter-spacing: -0.5px;
}

.routine-btn-count {
    font-size: 12px;
    font-weight: 500;
    color: rgba(12,14,16,0.6);
}

.routine-btn-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: 4px;
}

.routine-btn-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid rgba(0,0,0,0.15);
    color: rgba(12,14,16,0.7);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.routine-btn-last {
    font-size: 11px;
    font-weight: 500;
    color: rgba(0,0,0,0.5);
}

.routine-btn-arrow {
    color: rgba(12,14,16,0.4);
    font-size: 24px;
    font-weight: 300;
    flex-shrink: 0;
}

/* === STATS === */
.stat-summary {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-4);
    flex-wrap: wrap;
}

.stat-inline {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.stat-sep {
    color: var(--text-tertiary);
    font-size: var(--font-caption);
}

.stat-value {
    font-size: var(--font-title);
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-family: var(--font-family);
}

.stat-label {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

/* === PR LIST === */
.pr-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--divider);
}

.pr-name {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    color: var(--text-primary);
    flex: 1;
}

.pr-value {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    text-align: right;
}

.pr-date {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    margin-left: var(--space-2);
}

/* === MEASUREMENTS === */
.measure-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
}

.measure-label {
    font-size: var(--font-caption);
    color: var(--text-secondary);
}

.measure-value {
    font-size: var(--font-caption);
    color: var(--text-primary);
    font-weight: var(--weight-caption);
}

.measure-trend {
    font-size: var(--font-label);
    margin-left: var(--space-1);
}
.measure-trend.up { color: var(--positive); }
.measure-trend.down { color: var(--negative); }
.measure-trend.same { color: var(--text-tertiary); }


/* === SCORE MODAL === */
.score-modal {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.score-modal-number {
    font-size: 4rem;
    font-weight: var(--weight-display);
    line-height: 1;
    font-family: var(--font-family);
}

.score-modal-label {
    font-size: var(--font-body);
    color: var(--text-secondary);
    margin-top: var(--space-3);
}

.score-modal-quote {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--space-4);
}

.score-modal-btn {
    margin-top: var(--space-6);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    background: var(--surface-3);
    border: none;
    color: var(--text-primary);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.score-modal-btn.accent { background: var(--accent); color: var(--bg); }

/* === COMPLETION BUTTONS === */
.complete-row {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
}

.complete-btn {
    flex: 1;
    padding: 1rem 1.4rem;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: var(--bg);
    font-size: var(--font-body);
    font-weight: 900;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    box-shadow: 0 15px 30px -5px rgba(180,248,204,0.3);
    -webkit-appearance: none;
}
.complete-btn:active { opacity: 0.8; }
.complete-btn.scored {
    background: var(--positive);
    opacity: 0.7;
}

.complete-save-btn {
    flex: 1;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-full);
    border: none;
    background: var(--surface-3);
    color: var(--text-primary);
    font-size: var(--font-caption);
    font-weight: var(--weight-title);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.complete-save-btn:active { opacity: 0.8; }


/* === EXERCISE PICKER === */
.picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--divider);
}

.picker-tab {
    flex: 1;
    padding: var(--space-3);
    text-align: center;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    -webkit-appearance: none;
}
.picker-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.picker-group-label {
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
}
.picker-item:active { background: var(--surface-2); }

.picker-item-name {
    font-size: var(--font-body);
    color: var(--text-primary);
}

/* === QUICK ADD (exercise picker) === */
.quick-add-form {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.quick-add-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    min-height: 52px;
    font-size: var(--font-body);
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.quick-add-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-glow);
}
.quick-add-input::placeholder { color: var(--text-tertiary); }
.quick-add-types {
    display: flex;
    gap: var(--space-2);
}
.quick-add-type {
    flex: 1;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    border: 1px solid var(--outline);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast);
}
.quick-add-type.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}
.quick-add-recent-label {
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.quick-add-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-4);
}
.quick-add-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    min-height: 44px;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration-fast);
}
.quick-add-chip:active {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.quick-add-chip-tag {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

/* === ROUTINE CARD (picker) === */
.routine-card {
    margin: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--divider);
    overflow: hidden;
    box-shadow: var(--elevation-1);
}

.routine-card-header {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    gap: var(--space-2);
}

.routine-card-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    flex: 1;
}

.routine-card-count {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    background: var(--surface-3);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.routine-card-chevron {
    font-size: 20px;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}
.routine-card.expanded .routine-card-chevron { transform: rotate(180deg); }

.routine-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}
.routine-card.expanded .routine-card-body {
    max-height: 500px;
}

.routine-exercise-row {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    gap: var(--space-2);
}

.routine-checkbox {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--surface-3);
    cursor: pointer;
    flex-shrink: 0;
}
.routine-checkbox.checked {
    background: var(--accent);
}

.routine-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) 0 var(--space-1);
}

.routine-add-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--duration-fast);
    -webkit-appearance: none;
    background: var(--accent);
    color: var(--bg);
}
.routine-add-btn:active { transform: scale(0.97); }
.routine-add-btn + .routine-add-btn {
    background: var(--accent-dim);
    color: var(--accent);
}

/* === SUPERSET GROUP === */
.superset-group {
    position: relative;
}
.superset-group::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 0 0 var(--radius-sm);
}
.superset-between {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 32px;
    margin: 2px 0;
    gap: var(--space-2);
}

.superset-label {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    font-weight: var(--weight-label);
    letter-spacing: 0.05em;
}

.superset-link-btn {
    font-size: var(--font-label);
    color: #2b1f46;
    background: #cfbff0;
    border: none;
    padding: 8px 24px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: inherit;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    -webkit-appearance: none;
}
.superset-link-btn.linked {
    color: var(--accent);
    background: var(--accent-dim);
}

/* === WORKOUT VIEW === */
.workout-view {
    display: flex;
    flex-direction: column;
}

.workout-sets {
    padding: 0;
}

.set-row.set-header {
    padding: var(--space-1) var(--space-2);
    margin: 0 var(--space-2);
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    gap: var(--space-2);
}

.header-cell {
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-spacer {
    width: 36px;
}

.set-tf-bar {
    position: absolute;
    right: calc(-1 * var(--space-2) - var(--space-3));
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--positive);
    border-radius: 2px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.15s;
    box-shadow: 0 0 10px rgba(180,248,204,0.3);
}
.set-tf-bar:active { opacity: 1; }
.set-row.to-failure .set-tf-bar { opacity: 1; }
.set-row.set-done .set-delete-bar,
.set-row.set-done .set-tf-bar { display: none; }

/* === MOVE BAR === */
.ex-move-bar {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4) var(--space-2);
    background: var(--surface-2);
}

.ex-move-btn {
    flex: 1;
    padding: var(--space-2) var(--space-6);
    border-radius: var(--radius-sm);
    border: none;
    background: var(--surface-3);
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.ex-move-btn:not(:disabled):active { background: var(--accent); color: var(--bg); transform: scale(0.95); }
.ex-move-btn:disabled { opacity: 0.3; }
.ex-move-btn.rest-timer-btn { color: var(--accent); }

/* === REORDER MODE === */
.exercise-reorder {
    margin: var(--space-1) var(--space-3);
}
.exercise-reorder .workout-exercise-header {
    padding: var(--space-2) var(--space-3);
}
.reorder-arrows {
    display: flex;
    gap: var(--space-1);
}
.reorder-arrow-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    -webkit-appearance: none;
}
.reorder-arrow-btn:not(:disabled):active { background: var(--accent); color: var(--bg); transform: scale(0.95); }
.reorder-arrow-btn:disabled { opacity: 0.3; }
.reorder-toggle-btn {
    width: calc(100% - var(--space-6));
    margin: var(--space-1) var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    border: none;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    -webkit-appearance: none;
}
.reorder-toggle-btn:active { background: var(--surface-3); }
.reorder-toggle-btn.reorder-done {
    background: var(--accent);
    color: var(--bg);
}
.reorder-toggle-btn.reorder-done:active { opacity: 0.8; }

.superset-between-label {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    font-weight: var(--weight-label);
    letter-spacing: 0.05em;
}

.workout-footer {
    padding: var(--space-2) 0;
}

/* === SET ROW EXTRAS === */
.set-stepper-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.set-row > .input-stepper {
    flex: 1;
    min-width: 0;
}

.set-delete-bar {
    position: absolute;
    left: calc(-1 * var(--space-2) - var(--space-3));
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--negative);
    opacity: 0.3;
    border-radius: 2px;
    cursor: pointer;
    transition: opacity 0.15s;
    box-shadow: 0 0 10px rgba(255,113,108,0.3);
}
.set-delete-bar:active { opacity: 1; }

.set-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12,14,16,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    z-index: 10;
    border-radius: var(--radius-sm);
}

.set-confirm-yes {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: rgba(255,69,58,0.15);
    color: var(--negative);
    border: none;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}

.set-confirm-no {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--positive);
    color: var(--bg);
    border: none;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}

.tf-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.55rem;
    font-weight: var(--weight-title);
    color: var(--warning);
    background: rgba(255,159,10,0.15);
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    pointer-events: none;
}

.set-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
    -webkit-appearance: none;
}
.set-delete:active { color: var(--text-secondary); }

/* === ADD SET BUTTON === */
.add-set-btn {
    width: calc(100% - var(--space-4));
    padding: 14px;
    margin: var(--space-2) var(--space-2) var(--space-3);
    background: linear-gradient(180deg, #24282c 0%, #1d2023 100%);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--font-label);
    font-weight: 900;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 20px -6px rgba(0,0,0,0.5);
    -webkit-appearance: none;
}
.add-set-btn:active { background: var(--surface-4); }

/* === DELOAD === */
.deload-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
}
.deload-btn.active {
    background: var(--warning);
    border-radius: var(--radius-sm);
}

.deload-warning {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-label);
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* === REST PICKER === */
.rest-picker {
    display: none;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-4) var(--space-2);
}
.rest-picker.open { display: flex; }

.rest-pill {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.rest-pill.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}

/* === MOVE BAR === */
.move-bar {
    display: none;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4) var(--space-2);
}
.move-bar.open { display: flex; }

.move-btn {
    flex: 1;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.move-btn:active { background: var(--surface-3); }
.move-btn:disabled { opacity: 0.3; }

/* === COMPACT MODE === */
.compact-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--divider);
    margin: var(--space-1) var(--space-3);
    cursor: grab;
    box-shadow: var(--elevation-1);
}
.compact-card:active { cursor: grabbing; }

.compact-drag {
    color: var(--text-tertiary);
    font-size: 18px;
    flex-shrink: 0;
}

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

.compact-name {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.compact-muscle-tag {
    display: inline-block;
    margin-left: var(--space-2);
}

/* === FORM TIPS === */
.tip-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
}
.tip-row:active { background: var(--surface-3); }

.tip-badge {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-label);
    font-weight: var(--weight-title);
    flex-shrink: 0;
}

.tip-text {
    font-size: var(--font-caption);
    color: var(--text-primary);
    flex: 1;
}

.tip-play {
    color: var(--accent);
    font-size: 14px;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-4);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.empty-text {
    font-size: var(--font-body);
    color: var(--text-secondary);
}

/* === SECTION HEADER === */
.section-header {
    padding: var(--space-4) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    font-family: var(--font-family);
}

/* === MULTIPLIER BADGE === */
.multiplier-badge {
    display: inline-block;
    font-size: var(--font-label);
    font-weight: var(--weight-headline);
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    margin-left: var(--space-1);
}

/* === EXERCISE LIST (library view) === */
.exercise-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    margin: 0 var(--space-3) var(--space-2);
    cursor: pointer;
    transition: transform 0.1s ease;
    box-shadow: var(--elevation-1);
}
.exercise-list-item:active { transform: scale(0.98); }

.exercise-list-name {
    font-size: var(--font-body);
    font-weight: var(--weight-caption);
}

.exercise-list-muscle {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

.exercise-list-pr {
    font-size: var(--font-label);
    color: var(--warning);
    font-weight: 600;
    text-align: right;
}


/* === VIDEO MODAL === */
.video-backdrop {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.video-backdrop.open { display: flex; }

.video-container {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.video-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(40,40,40,0.85);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
}

.video-player {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-player iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
    background: #000;
}

/* === FORM TIPS FIXES === */
.tip-row:last-child { border-bottom: none; }

/* === WORKOUT EXERCISE CARDS === */
.workout-exercise {
    background: linear-gradient(165deg, #171a1d 0%, #111315 100%);
    border-radius: var(--radius-xl);
    margin: var(--space-2) var(--space-3);
    overflow: visible;
}

/* Completed exercise — dim via color, not opacity/filter (avoids Safari stacking context bug) */
.workout-exercise.exercise-complete {
    color: var(--text-tertiary);
}
.workout-exercise.exercise-complete .workout-exercise-name,
.workout-exercise.exercise-complete .set-input,
.workout-exercise.exercise-complete .stepper-btn,
.workout-exercise.exercise-complete .set-check,
.workout-exercise.exercise-complete .ex-move-btn {
    opacity: 0.5;
}

/* Current exercise — no card-level difference, dot added via exercise name */
.workout-exercise.exercise-current {
}
.workout-exercise.exercise-current .workout-exercise-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--accent);
    margin-right: var(--space-2);
    vertical-align: middle;
    flex-shrink: 0;
}

/* Celebration pulse when exercise completes */
@keyframes exerciseDone {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
.workout-exercise.exercise-just-done {
    animation: exerciseDone 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.workout-exercise-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
}

.workout-exercise-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ex-grip {
    color: var(--text-tertiary);
    cursor: grab;
    display: flex;
    align-items: center;
    padding: var(--space-1);
}
.ex-grip:active { cursor: grabbing; }

.ex-note {
    padding: var(--space-1) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    cursor: pointer;
}

.add-exercise-btn {
    width: calc(100% - var(--space-6));
    margin: var(--space-2) var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: none;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    -webkit-appearance: none;
}
.add-exercise-btn:active { background: var(--surface-3); }
/* Prominent when workout is empty */
.add-exercise-btn.empty-workout {
    color: var(--accent);
    background: var(--accent-dim);
}
.add-exercise-btn.empty-workout:active { background: var(--surface-2); }


/* === SECONDARY HEADER (volume meter) === */
.secondary-header {
    padding: var(--space-2) var(--space-4);
    background: var(--surface-1);
    flex-shrink: 0;
}

.sec-header-text {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.vol-meter-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.vol-segments {
    display: flex;
    gap: 3px;
    height: 14px;
}

.vol-seg {
    flex: 1;
    border-radius: 4px;
    background: var(--surface-3);
    transition: background 0.3s, opacity 0.3s;
}

.vol-seg-filled {
    box-shadow: 0 0 8px rgba(255,194,203,0.25);
}

.workout-exercises {
    padding-bottom: var(--space-2);
}

/* === WORKOUT SCORED — full lockdown === */
.workout-scored .set-check { pointer-events: none; cursor: default; }
.workout-scored .set-check:active { transform: none; }
.workout-scored .set-row { opacity: 0.7; }
.workout-scored .set-delete-bar,
.workout-scored .set-tf-bar,
.workout-scored .add-set-btn,
.workout-scored .deload-btn,
.workout-scored .ex-grip,
.workout-scored .superset-link-btn {
    pointer-events: none;
    opacity: 0.3;
}

/* === DONE STATE EXTRAS === */
.set-row.set-done .set-input { color: var(--text-secondary); }
.set-row.deload .set-delete-bar { background: var(--warning); }

/* === ANIMATIONS === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}


/* === RESPONSIVE — narrow screens (iPhone 13 = 390px) === */
@media (max-width: 400px) {
    .header-title { font-size: 1.1rem; }
    .header-avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* === EXERCISE FOCUS OVERLAY === */
.focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 12px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.focus-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.focus-panel {
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    transform: scale(0.95);
    transition: transform 0.35s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.focus-overlay.open .focus-panel {
    transform: scale(1);
}

.focus-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-5) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--divider);
}

.focus-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.focus-subtitle {
    font-size: var(--font-caption);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.focus-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.focus-close:active { background: var(--surface-4); }

.focus-body {
    padding: var(--space-3) var(--space-5) var(--space-5);
    overflow-y: auto;

    flex: 1;
    min-height: 0;
}

.focus-section {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--divider);
}
.focus-section:last-child { border-bottom: none; }

.focus-section-header {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.focus-section-icon {
    font-size: 18px;
    color: var(--text-tertiary);
}

.focus-section-primary .focus-last-sets,
.focus-section-primary .focus-setup-fields {
    font-size: var(--font-body);
}

/* PR badge */
.focus-pr {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--record);
}

.focus-pr-icon {
    background: var(--record);
    color: #000;
    font-size: var(--font-label);
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.focus-pr-date {
    font-size: var(--font-label);
    font-weight: 400;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* Photo */
.focus-photo-wrap {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-1);
}

.focus-photo {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

.focus-photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.6);
    border: none;
    color: var(--negative);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.focus-photo-add {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}
.focus-photo-add:active { background: var(--surface-2); }

.focus-photo-compact {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
}
.focus-photo-compact:active { color: var(--text-secondary); }

/* Machine setup */
.focus-setup-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.focus-setup-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.focus-setup-label {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    min-width: 48px;
}

.focus-setup-input {
    width: 56px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-family: inherit;
    text-align: center;
}
.focus-setup-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-glow);
}

.focus-setup-remove {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: none;
    border: none;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.focus-setup-remove:active { color: var(--negative); }

.focus-add-btn {
    margin-top: var(--space-2);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    font-family: inherit;
    cursor: pointer;
}
.focus-add-btn:active { background: var(--surface-2); }

.focus-add-setup-link {
    display: block;
    width: 100%;
    padding: var(--space-3) 0;
    background: none;
    border: none;
    border-top: 1px solid var(--divider);
    color: var(--text-tertiary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}
.focus-add-setup-link:active { color: var(--text-secondary); }

.focus-empty {
    font-size: var(--font-caption);
    color: var(--text-tertiary);
    font-style: italic;
}

/* Notes */
.focus-note-text {
    font-size: var(--font-body);
    color: var(--text-primary);
    line-height: 1.5;
}
.focus-note-text.empty {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Last session */
.focus-last-sets {
    font-size: var(--font-body);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Form tips inline */
.focus-tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    cursor: pointer;
}
.focus-tip:active { opacity: 0.6; }

.focus-tip-thumb-wrap {
    position: relative;
    width: 80px;
    height: 45px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.focus-tip-thumb-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    /* CSS triangle play icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
}

.focus-tip-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    display: block;
}

.focus-tip-content {
    flex: 1;
    min-width: 0;
}

.focus-tip-text {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Rest timer pills */
.focus-rest-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

/* === FOCUS RINGS === */
.btn:focus-visible,
.icon-btn:focus-visible,
.set-check:focus-visible,
.timer-preset:focus-visible,
.timer-start-btn:focus-visible,
.rest-pill:focus-visible,
.tab-switch-btn:focus-visible,
.picker-tab:focus-visible,
.action-sheet-item:focus-visible,
.bento-nav-tile:focus-visible,
.bento-primary-nav:focus-visible,
.profile-btn:focus-visible,
.routine-btn:focus-visible,
.cal-nav-btn:focus-visible,
.add-exercise-btn:focus-visible,
.add-set-btn:focus-visible,
.ex-move-btn:focus-visible,
.score-modal-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-glow);
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === SCROLLBAR STYLING === */
.app-content::-webkit-scrollbar { display: none; }
.app-content { -ms-overflow-style: none; scrollbar-width: none; }
