:root {
    /* Surfaces */
    --bg:            #0B0C0E;
    --bg-card:       #141619;
    --bg-hover:      #1A1D21;
    --border:        #1F2227;
    --border-light:  #17191D;

    /* Accent — coral */
    --accent:        #FF5C38;
    --accent-light:  #FF8A3D;
    --accent-bg:     rgba(255, 92, 56, 0.12);

    /* Text */
    --text:          #F4F5F7;
    --text-secondary:#8B8F98;
    --text-dim:      #6A6E78;

    /* Status colors (tuned for dark bg) */
    --green:    #3DD68C;  --green-bg:  rgba(61, 214, 140, 0.12);
    --yellow:   #FFB020;  --yellow-bg: rgba(255, 176, 32, 0.12);
    --red:      #FF5C5C;  --red-bg:    rgba(255, 92, 92, 0.12);
    --blue:     #3B5BDB;  --blue-bg:   rgba(59, 91, 219, 0.12);

    /* Radii */
    --radius:    14px;
    --radius-lg: 22px;

    /* Shadows — soft, dark */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow:    0 4px 16px rgba(0,0,0,0.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,0.6);
}

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

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.stat-value,
#workout-duration,
.tnum,
.countdown,
.activity-item .stat {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Header */
header {
    background: var(--bg-card);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
h1 span { color: var(--accent); }

.countdown {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--accent-bg);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}
.countdown strong {
    color: var(--accent);
    font-weight: 700;
}

nav {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border-light);
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.nav-link:hover { color: var(--text); }

/* Main */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page { animation: fadeIn 0.2s ease; }
.hidden { display: none !important; }

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

h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: none;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.03);
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04); }

/* Stat cards row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: none;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.03);
}
.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.04em;
}
.stat-card .stat-sub {
    font-size: 0.72rem;
    color: #a0aec0;
    margin-top: 0.15rem;
}
.stat-card .stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.2rem;
}
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }
.stat-trend.neutral { color: var(--text-dim); }

/* Buttons */
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:hover { background: var(--accent-light); box-shadow: var(--shadow-sm); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-bg); border-color: var(--accent); }

/* Alert banner */
.alert-banner {
    background: var(--red);
    color: #fff;
    padding: 0.6rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Week grid */
.week-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.day-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 0.65rem;
    border: 1px solid var(--border);
    min-height: 100px;
    transition: box-shadow 0.15s;
}
.day-card:hover { box-shadow: var(--shadow); }
.day-card.completed { border-left: 3px solid var(--green); }
.day-card.missed { border-left: 3px solid var(--red); opacity: 0.7; }
.day-card.rest { border-left: 3px solid var(--blue); }

.day-card .day-name {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text);
}
.day-card .day-date {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}
.day-card .plan-item {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-bottom: 0.1rem;
}
.day-card .actual-item {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text);
    padding: 0.15rem 0;
    margin-top: 0.2rem;
}

/* Charts */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: none;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.03);
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Activity list */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f4f8;
    transition: background 0.1s;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.activity-item:hover { background: var(--bg-hover); }
.activity-item:last-child { border-bottom: none; }
.activity-item .date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 100px;
}
.activity-item .stat {
    font-size: 0.82rem;
    display: flex;
    gap: 1.25rem;
    font-weight: 500;
}
.activity-item .stat span {
    white-space: nowrap;
    color: var(--text);
}

/* Exercise grid */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.exercise-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: none;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 2px 12px rgba(0,0,0,0.03);
}
.exercise-card:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.exercise-card.tracked { border-left: 3px solid var(--accent); }
.exercise-card .ex-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.exercise-card .ex-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.exercise-card .ex-1rm {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 0.25rem;
}

/* Exercise detail modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.modal-header h2 { margin-bottom: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0.25rem;
}

/* Insights */
.coaching-page { max-width: 720px; }
.coaching-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.coaching-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}
.coaching-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.3;
}
.coaching-paragraph {
    margin-bottom: 1.25rem;
}
.coaching-paragraph h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.coaching-paragraph .cp-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.2rem;
}
.coaching-paragraph p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}
.coaching-kpi-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.coaching-kpi {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}
.coaching-kpi .kpi-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.coaching-kpi .kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.coaching-kpi .kpi-sub {
    font-size: 0.72rem;
    color: var(--text-dim);
}
.coaching-divider {
    height: 1px;
    background: var(--border-light);
    margin: 1.25rem 0;
}
.insight-card {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}
.insight-card.success { background: var(--green-bg); border-color: var(--green); }
.insight-card.warning { background: var(--yellow-bg); border-color: var(--yellow); }
.insight-card.info { background: var(--blue-bg); border-color: var(--blue); }
.insight-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.insight-body .insight-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}
.insight-body .insight-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Upload */
.upload-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.upload-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.upload-card h3 {
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
    font-size: 0.9rem;
}
.upload-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.drop-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
}

.upload-status { margin-top: 0.5rem; font-size: 0.78rem; }
.upload-status .success { color: var(--green); }
.upload-status .error { color: var(--red); }
.upload-status .info { color: var(--blue); }

/* Alerts */
.alerts-list { margin-top: 1rem; }

.alert-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.alert-item.warning { border-left: 3px solid var(--yellow); }
.alert-item.critical { border-left: 3px solid var(--red); }
.alert-item.info { border-left: 3px solid var(--blue); }

.alert-item .alert-body { flex: 1; }
.alert-item .alert-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}
.alert-item .alert-msg { font-size: 0.82rem; line-height: 1.45; }
.alert-item .alert-week {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.badge.warning { background: var(--yellow-bg); color: var(--yellow); }
.badge.critical { background: var(--red-bg); color: var(--red); }
.badge.info { background: var(--blue-bg); color: var(--blue); }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg) 25%, #e8ecf1 50%, var(--bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    min-height: 80px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* HR Zone bars */
.hr-zone-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
}
.hr-zone-bar .zone-label {
    width: 60px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.72rem;
}
.hr-zone-bar .zone-bar {
    flex: 1;
    height: 20px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}
.hr-zone-bar .zone-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.hr-zone-bar .zone-pct {
    width: 40px;
    text-align: right;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.zone-fill.z1 { background: #90caf9; }
.zone-fill.z2 { background: var(--green); }
.zone-fill.z3 { background: var(--yellow); }
.zone-fill.z4 { background: #ff7043; }
.zone-fill.z5 { background: var(--red); }

/* Responsive */
@media (max-width: 768px) {
    header { padding: 0 1rem; }
    main { padding: 1rem; }
    .week-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .charts-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .exercise-grid { grid-template-columns: 1fr; }
    .upload-cards { grid-template-columns: 1fr; }
    .modal { margin: 0.5rem; max-height: 90vh; }
}

@media (max-width: 480px) {
    .week-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .day-card { padding: 0.5rem; min-height: 80px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}

/* Workout page */
.workout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.workout-timer-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.workout-action-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
#workout-duration {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.exercise-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}
.exercise-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.exercise-block h3 {
    color: var(--accent);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.95rem;
    margin-bottom: 0;
}
.remove-exercise-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.remove-exercise-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
}
.set-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.set-table th {
    text-align: left;
    padding: 0.25rem 0.5rem;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
}
.set-table td {
    padding: 0.35rem 0.5rem;
}
.set-table td:has(input) {
    padding: 0.25rem 0.2rem;
}
.set-table input {
    width: 100%;
    max-width: 70px;
    padding: 0.5rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px; /* 16px prevents iOS auto-zoom */
    text-align: center;
    background: var(--bg);
    font-family: inherit;
    color: inherit;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
    position: relative;
    z-index: 5;
}
.set-table input:focus {
    border-color: var(--accent);
    outline: none;
    background: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(99, 91, 255, 0.25);
}
.set-table .prev {
    color: var(--text-dim);
    font-size: 0.8rem;
}
.set-table .done-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.set-table .done-btn.checked {
    background: #0cbc87;
    border-color: #0cbc87;
    color: white;
}
.set-row {
    position: relative;
    transition: background 0.2s;
}
.set-row.set-done {
    background: rgba(12, 188, 135, 0.18);
}
.set-row.set-done td {
    color: var(--text);
}
.set-row.set-done td:first-child {
    position: relative;
}
.set-row.set-done td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    background: #0cbc87;
    border-radius: 2px;
}
.set-row.input-active {
    z-index: 10;
}
.set-table .pr-badge {
    background: #f5a623;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
}
.exercise-title-clickable {
    cursor: pointer;
    transition: color 0.15s;
}
.exercise-title-clickable:hover {
    color: var(--accent-light);
}
.set-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.add-set-btn, .remove-set-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.add-set-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.remove-set-btn:hover {
    border-color: var(--red);
    color: var(--red);
}
.workout-footer {
    text-align: center;
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.add-exercise-btn {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-family: inherit;
}
.add-exercise-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Circular rest timer overlay */
.rest-timer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.rest-timer-overlay.hidden {
    display: none;
}
.rest-timer-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.rest-timer-circle-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 1.5rem;
}
.rest-timer-svg {
    width: 100%;
    height: 100%;
}
.rest-timer-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.rest-timer-label-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.rest-timer-time {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.rest-timer-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

/* Workout mini floating action button */
.workout-mini-fab {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 4px 16px rgba(99, 91, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideUp 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    font-variant-numeric: tabular-nums;
}
.workout-mini-fab.hidden {
    display: none;
}
.workout-mini-fab:active {
    transform: translateX(-50%) scale(0.95);
}
.mini-fab-pulse {
    width: 8px;
    height: 8px;
    background: #0cbc87;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100%); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ── Exercise Note (Sticky Note) ────────────────────── */
.exercise-note-row {
    margin-bottom: 0.5rem;
    position: relative;
}
.exercise-note-input {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--text-secondary);
    font-style: italic;
    transition: all 0.15s;
}
.exercise-note-input:focus {
    border-style: solid;
    border-color: var(--accent);
    background: var(--bg);
    outline: none;
    font-style: normal;
    color: var(--text);
}
.exercise-note-input::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* ── Inline Rest Timer Widget (under set) ───────────── */
.inline-rest-widget {
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius);
    padding: 0.4rem 0.5rem;
}
.inline-rest-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}
.inline-rest-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    transition: width 0.25s linear;
}
.inline-rest-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.inline-rest-time {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #3b82f6;
}
.inline-rest-controls {
    display: flex;
    gap: 0.35rem;
}
.inline-rest-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.inline-rest-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.inline-rest-btn.skip {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}
.inline-rest-btn.skip:hover {
    background: #2563eb;
}

/* ── Exercise Picker Modal ──────────────────────────── */
.exercise-picker-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.exercise-picker-item:hover {
    background: var(--accent-bg, rgba(99, 91, 255, 0.08));
}
.exercise-picker-item.selected {
    background: rgba(99, 91, 255, 0.12);
}
.exercise-picker-check {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    transition: all 0.15s;
}
.exercise-picker-item.selected .exercise-picker-check {
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Modal Tabs ─────────────────────────────────────── */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}
.modal-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.modal-tab:hover:not(.active) {
    color: var(--text);
}
.modal-tab-content.hidden {
    display: none;
}

/* ── History Tab ────────────────────────────────────── */
.history-session {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.history-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.history-date {
    font-weight: 600;
    font-size: 0.85rem;
}
.history-1rm {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}
.history-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.history-set {
    background: var(--bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ── Records Tab ────────────────────────────────────── */
.records-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.record-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
}
.record-icon {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}
.record-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.03em;
    margin-bottom: 0.2rem;
}
.record-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}
.record-date {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

/* Clickable run items */
.activity-clickable {
    cursor: pointer;
    position: relative;
    padding-right: 2rem !important;
}
.activity-clickable:hover {
    background: var(--accent-bg) !important;
    border-left: 3px solid var(--accent);
}
.run-chevron {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-dim);
    font-weight: 300;
}
.activity-clickable:hover .run-chevron {
    color: var(--accent);
}

/* Splits table */
.splits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-top: 0.5rem;
}
.splits-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
}
.splits-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    font-variant-numeric: tabular-nums;
}
.splits-table tbody tr:hover {
    background: var(--bg-hover);
}
.split-km {
    font-weight: 600;
    color: var(--text-secondary);
    width: 40px;
}
.split-pace {
    font-weight: 600;
    min-width: 120px;
}
.split-pace-bar-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.split-pace-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--accent-bg);
    border-radius: 3px;
    z-index: 0;
}
.split-pace-bar-wrap span {
    position: relative;
    z-index: 1;
    padding: 0.1rem 0.3rem;
}
.split-fastest td {
    color: var(--green);
}
.split-fastest .split-pace {
    color: var(--green);
    font-weight: 700;
}
.split-slowest td {
    color: var(--text-dim);
}
.split-slowest .split-pace {
    color: var(--text-dim);
}

/* ── Today's Workout Card ─────────────────────────────── */
.today-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-left: 4px solid var(--accent);
}
.today-card.rest {
    border-left-color: var(--green);
}
.today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    font-size: 0.85rem;
}
.today-label {
    font-weight: 700;
    color: var(--text);
}
.today-phase {
    font-size: 0.75rem;
    color: var(--text-dim);
}
.today-body {
    padding: 1rem 1.25rem;
}
.today-run-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text);
}
.today-run-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.today-run-meta {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.today-run-meta strong {
    color: var(--text);
}
.today-segments {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}
.segment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-light);
}
.segment-row:last-child {
    border-bottom: none;
}
.segment-name {
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.segment-dist {
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
}
.segment-pace {
    color: var(--accent);
    font-weight: 600;
    min-width: 90px;
    text-align: right;
}
.today-coaching {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.coaching-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.3rem;
}
.coaching-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.today-strength {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* Plan type badge on day cards */
.plan-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    margin-top: 0.25rem;
}

/* Day card upcoming status */
.day-card.upcoming {
    opacity: 0.8;
    border: 1px dashed var(--border);
}

/* Modal content for run prescription */
.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}
