:root {
    --ink: #11130f;
    --muted: #71766b;
    --paper: #f3f3ed;
    --card: #fbfbf7;
    --line: #dcded4;
    --acid: #ff5fa2;
    --acid-dark: #e8458f;
    --white: #fff;
    --radius: 20px;
    --display: "Syne", "Arial Black", sans-serif;
    --body: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); }
body { margin: 0; color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #f5458f; outline-offset: 3px; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-family: var(--display); font-size: 12px; font-weight: 800; letter-spacing: 1.7px; text-decoration: none; }
.brand--light { color: #f5f6f0; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--acid); color: var(--ink); font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: 0; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 2px; }
.button { display: inline-flex; min-height: 55px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border: 0; border-radius: 10px; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; transition: transform .18s, background .18s, opacity .18s; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button--dark { background: var(--ink); color: white; }
.button--dark:hover { background: #292e23; }
.button--accent { background: var(--acid); color: var(--ink); }
.button--accent:hover { background: var(--acid-dark); }
.button--full { width: 100%; }

.loading-screen { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.loading-screen .brand { position: relative; z-index: 1; }
.loading-line { position: absolute; top: calc(50% + 40px); width: 160px; height: 2px; overflow: hidden; background: #2b3026; }
.loading-line::after { display: block; width: 55%; height: 100%; background: var(--acid); content: ""; animation: load 1s ease-in-out infinite alternate; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(180%); } }

.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.18fr) minmax(410px, .82fr); background: var(--paper); }
.cover-panel { position: relative; min-height: calc(100vh - 64px); margin: 32px; overflow: hidden; border-radius: 22px; background: #0a0c08; }
.album-cover { display: block; width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.auth-panel { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: 38px clamp(38px, 5vw, 84px) 26px; }
.auth-content { width: 100%; max-width: 440px; margin: auto; padding: 40px 0; }
.auth-heading { margin: 0 0 38px; }
.auth-heading h1 { margin: 0; font-family: var(--display); font-size: clamp(48px, 5vw, 72px); font-weight: 600; letter-spacing: -4px; line-height: .98; }
.login-form { display: grid; gap: 22px; }
.field { display: grid; gap: 9px; }
.field > span { display: flex; justify-content: space-between; color: #454a40; font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.field small { color: #92978b; font-size: 8px; letter-spacing: 1px; }
.field input, .field select { width: 100%; height: 52px; padding: 0 15px; border: 1px solid #d4d7cb; border-radius: 9px; outline: 0; background: #fafaf6; color: var(--ink); font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.field select { padding-right: 34px; appearance: none; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" fill="none" stroke="%23454a40" stroke-width="1.5" stroke-linecap="round"/></svg>'); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.field input::placeholder { color: #a2a69b; }
.field input:focus, .field select:focus { border-color: #d16a9e; box-shadow: 0 0 0 3px rgba(245, 69, 143, .18); }
.password-field { position: relative; }
.password-field input { padding-right: 65px; }
.password-toggle { position: absolute; top: 0; right: 7px; height: 52px; padding: 0 9px; border: 0; background: transparent; color: #767c6e; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.form-error { margin: -7px 0; padding: 11px 13px; border-radius: 7px; background: #f7e6df; color: #943e2d; font-size: 12px; line-height: 1.4; }
.auth-switch { margin: 24px 0 0; color: #858a7e; font-size: 11px; text-align: center; }
.auth-switch button { padding: 4px; border: 0; background: transparent; color: #b43d78; font-size: 9px; font-weight: 800; letter-spacing: .7px; }
.auth-switch button:hover { color: #e8458f; }

.app-shell { min-height: 100vh; background: var(--paper); }
.app-header { display: flex; height: 76px; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4vw, 68px); background: var(--ink); }
.header-right { display: flex; align-items: center; gap: 22px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; color: #c3c8bb; font-size: 8px; font-weight: 600; letter-spacing: 1.5px; }
.live-pill > span { width: 5px; height: 5px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 8px var(--acid); }
.header-divider { width: 1px; height: 20px; background: #363b31; }
.user-name { color: #c3c8bb; font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.logout-button { padding: 8px 0; border: 0; background: none; color: var(--acid); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.logout-button span { margin-left: 6px; }
.app-main { width: min(1440px, 100%); margin: 0 auto; padding: 55px clamp(24px, 4vw, 68px) 25px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.dashboard-heading h1 { margin: 11px 0 9px; font-family: var(--display); font-size: clamp(36px, 4.3vw, 60px); font-weight: 600; letter-spacing: -3.5px; line-height: 1.05; }
.dashboard-heading h1 em { color: #e0509a; font-family: Georgia, serif; font-weight: 400; }
.dashboard-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.date-navigation { display: flex; align-items: stretch; gap: 7px; }
.icon-button, .today-button, .date-picker { height: 48px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.icon-button { width: 44px; color: #4c5246; font-size: 17px; transition: background .15s; }
.icon-button:hover { background: #e7e9df; }
.date-picker { position: relative; display: grid; min-width: 138px; place-items: center; padding: 0 13px; }
.date-picker > span { pointer-events: none; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; }
.date-picker input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.today-button { padding: 0 15px; color: #4c5246; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.today-button:hover { background: #e7e9df; }

.week-card { margin-bottom: 18px; padding: 18px 22px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.week-card__heading { display: flex; justify-content: space-between; margin-bottom: 16px; color: #7b8074; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; }
.week-day { position: relative; display: flex; min-height: 78px; align-items: center; justify-content: center; flex-direction: column; gap: 7px; border: 1px solid transparent; border-radius: 11px; background: #f0f1e9; color: var(--ink); transition: transform .15s, background .15s; }
.week-day:hover { transform: translateY(-2px); background: #e8ebdf; }
.week-day.is-selected { border-color: var(--ink); background: var(--ink); color: white; }
.week-day__name { color: #7b8173; font-size: 8px; font-weight: 700; letter-spacing: 1.2px; }
.week-day.is-selected .week-day__name { color: #c8cec0; }
.week-day__date { font-family: var(--display); font-size: 20px; font-weight: 600; line-height: 1; }
.week-day__dots { display: flex; min-height: 4px; gap: 3px; }
.week-day__dots i { display: block; width: 4px; height: 4px; border-radius: 50%; background: #bd87a3; }
.week-day.is-selected .week-day__dots i { background: var(--acid); }
.week-day__today { position: absolute; top: 6px; right: 6px; width: 4px; height: 4px; border-radius: 50%; background: #f5458f; }

.stats-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.stat-card { min-height: 164px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.stat-card--accent { border-color: var(--acid); background: var(--acid); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; font-size: 8px; font-weight: 700; letter-spacing: 1.4px; }
.stat-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--acid); font-size: 12px; }
.stat-icon--muted { background: #e8eae0; color: #676e5e; }
.stat-card strong { font-family: var(--display); font-size: 39px; font-weight: 600; letter-spacing: -2px; }
.stat-unit { margin-left: 8px; color: #626957; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.stat-card p { margin: 8px 0 0; color: #747a6c; font-size: 10px; }
.stat-card--accent p { color: #63264b; }

.workout-grid { display: grid; grid-template-columns: minmax(330px, .77fr) minmax(420px, 1.23fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.exercise-form-panel { padding: 27px; }
.exercises-panel { padding: 27px 18px 18px 27px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.section-number { display: block; margin-bottom: 8px; color: #858b7c; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; }
.panel-heading h2 { margin: 0; font-family: var(--display); font-size: 23px; font-weight: 600; letter-spacing: -1px; }
.panel-heading__icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--acid); font-size: 18px; }
.template-picker { margin-bottom: 26px; }
.template-picker .section-number { margin-bottom: 10px; }
.template-list { display: grid; gap: 8px; }
.template-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid #dfe2d6; border-radius: 10px; background: #f5f6f0; text-align: left; transition: transform .15s, background .15s, border-color .15s; }
.template-chip:hover { border-color: #b9c0aa; background: #eef0e5; transform: translateY(-1px); }
.template-chip strong { font-family: var(--display); font-size: 12px; font-weight: 700; }
.template-chip span { color: #8b9183; font-size: 8px; font-weight: 600; letter-spacing: .7px; text-align: right; }
.exercise-form { display: grid; gap: 21px; }
.field--light > span { font-size: 10px; }
.field--light > input, .field--light > select { background: #f5f6f0; }
.counter-field { display: grid; height: 57px; grid-template-columns: 52px 1fr 52px; overflow: hidden; border: 1px solid #d4d7cb; border-radius: 9px; background: #f5f6f0; }
.counter-field > button { border: 0; background: transparent; color: #5c6353; font-size: 19px; }
.counter-field > button:first-child { border-right: 1px solid #e0e2d8; }
.counter-field > button:last-child { border-left: 1px solid #e0e2d8; }
.counter-field > button:hover { background: #e6e9dc; }
.counter-field > div { display: flex; align-items: center; justify-content: center; gap: 7px; }
.counter-field input { width: 80px; height: 54px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-family: var(--display); font-size: 21px; font-weight: 600; text-align: right; -moz-appearance: textfield; }
.counter-field input::-webkit-outer-spin-button, .counter-field input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.counter-field input:focus { box-shadow: none; }
.counter-field > div > span { color: #888e7f; font-size: 9px; font-weight: 700; }
.counter-field--small { grid-template-columns: 40px 1fr 40px; }
.counter-field--small input { width: 100%; text-align: center; }
.volume-preview { display: flex; align-items: center; justify-content: space-between; padding: 13px 0 0; border-top: 1px solid #e5e7de; color: #8a9080; font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.volume-preview strong { color: #565d4e; font-size: 10px; }
.exercise-count { padding: 7px 10px; border-radius: 20px; background: #eceee5; color: #72796a; font-size: 8px; font-weight: 700; letter-spacing: .8px; }
.exercises-heading__actions { display: flex; align-items: center; gap: 8px; }
.clear-day-button { padding: 7px 10px; border: 0; border-radius: 20px; background: #eceee5; color: #a44f3b; font-size: 8px; font-weight: 700; letter-spacing: .8px; transition: background .15s, color .15s; }
.clear-day-button:hover { background: #efe3dd; color: #943e2d; }
.exercises-heading { padding-right: 9px; }
.exercise-list { display: flex; max-height: 545px; min-height: 390px; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 9px; scrollbar-color: #c9cdbf transparent; scrollbar-width: thin; }
.empty-state { display: flex; flex: 1; min-height: 380px; align-items: center; justify-content: center; flex-direction: column; padding: 30px; border: 1px dashed #d8dbcf; border-radius: 13px; text-align: center; }
.empty-state__visual { position: relative; display: grid; width: 72px; height: 72px; place-items: center; margin-bottom: 20px; border-radius: 50%; background: #eef0e7; color: #838d73; font-family: var(--display); font-size: 27px; }
.empty-state__visual::after { position: absolute; inset: -6px; border: 1px dashed #d4d9c8; border-radius: 50%; content: ""; }
.empty-state h3 { margin: 0 0 8px; font-family: var(--display); font-size: 18px; font-weight: 600; }
.empty-state p { max-width: 250px; margin: 0; color: #858b7d; font-size: 11px; line-height: 1.6; }
.exercise-item { display: grid; grid-template-columns: 45px minmax(110px, 1fr) auto auto auto auto 30px 30px; align-items: center; gap: 14px; padding: 16px 12px 16px 15px; border: 1px solid #e0e2d8; border-radius: 12px; background: #f6f7f1; animation: appear .22s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.order-input { width: 42px; height: 42px; padding: 0; border: 1px solid transparent; border-radius: 10px; background: #e8ebdf; color: #69715e; font-family: var(--display); font-size: 13px; font-weight: 700; text-align: center; -moz-appearance: textfield; }
.order-input::-webkit-outer-spin-button, .order-input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.order-input:focus { border-color: #d16a9e; background: #fff; color: var(--ink); box-shadow: 0 0 0 3px rgba(245, 69, 143, .18); }
.exercise-item__name { overflow: hidden; }
.exercise-item__title { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.exercise-item__title strong { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.familiar-toggle { padding: 0 2px; border: 0; background: transparent; color: #c9cdc0; font-size: 13px; line-height: 1; cursor: pointer; transition: color .15s, transform .15s; }
.familiar-toggle:hover { color: #e0509a; transform: scale(1.15); }
.familiar-toggle--active { color: #e0509a; }
.exercise-item__name span, .exercise-item__metric span { color: #8b9183; font-size: 8px; font-weight: 600; letter-spacing: .7px; }
.type-select { height: 22px; padding: 0 14px 0 6px; border: 1px solid #dfe2d6; border-radius: 4px; appearance: none; background-color: #eceee5; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="6" height="4" viewBox="0 0 6 4"><path d="M1 1l2 2 2-2" fill="none" stroke="%238b9183" stroke-width="1.2" stroke-linecap="round"/></svg>'); background-repeat: no-repeat; background-position: right 4px center; color: #8b9183; font-size: 8px; font-weight: 700; letter-spacing: .7px; cursor: pointer; }
.type-select:hover { border-color: #b9c0aa; color: #6a7060; }
.type-select:focus { border-color: #d16a9e; background-color: #fff; color: var(--ink); box-shadow: 0 0 0 3px rgba(245, 69, 143, .18); outline: none; }
.exercise-item__metric { min-width: 65px; }
.exercise-item__metric strong { display: block; margin-bottom: 4px; font-family: var(--display); font-size: 14px; font-weight: 600; white-space: nowrap; }
.exercise-item__metric--volume strong { color: #9c4f78; }
.delete-exercise { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #a0a697; font-size: 16px; }
.delete-exercise:hover { background: #efe3dd; color: #a44f3b; }
.inline-metric { display: flex; align-items: stretch; flex-direction: column; gap: 5px; }
.inline-metric__value { display: flex; align-items: center; gap: 6px; }
.inline-metric input { width: 64px; height: 38px; padding: 0 6px; border: 1px solid #d4d7cb; border-radius: 8px; background: #fff; font-family: var(--display); font-size: 13px; font-weight: 600; text-align: center; -moz-appearance: textfield; }
.inline-metric input::-webkit-outer-spin-button, .inline-metric input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.inline-metric input:focus { border-color: #d16a9e; box-shadow: 0 0 0 3px rgba(245, 69, 143, .18); }
.inline-metric span { color: #8b9183; font-size: 8px; font-weight: 700; letter-spacing: .7px; }
.inline-metric__history { color: #9a9f91; font-size: 7px; font-weight: 600; letter-spacing: .4px; text-align: center; white-space: nowrap; }
.inline-metric--concealed { visibility: hidden; }
.save-exercise { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #a0a697; font-size: 13px; transition: background .15s, color .15s; }
.save-exercise:disabled { cursor: default; opacity: .45; }
.save-exercise:not(:disabled) { background: var(--acid); color: var(--ink); }
.save-exercise:not(:disabled):hover { background: var(--acid-dark); }
.app-footer { display: flex; justify-content: space-between; padding: 27px 2px 0; color: #92988a; font-size: 8px; font-weight: 600; letter-spacing: 1.2px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 48px)); padding: 15px 20px; border: 1px solid #3c4430; border-radius: 11px; background: var(--ink); box-shadow: 0 12px 35px rgba(0,0,0,.2); color: #f0f3e9; font-size: 12px; animation: appear .2s ease-out; }

@media (max-width: 1050px) {
    .auth-shell { grid-template-columns: 1fr 440px; }
    .auth-panel { padding-right: 38px; padding-left: 38px; }
    .workout-grid { grid-template-columns: minmax(300px, .85fr) minmax(370px, 1.15fr); }
    .exercise-item { grid-template-columns: 40px 1fr auto auto auto 28px 28px; gap: 10px; }
    .inline-metric input { width: 56px; }
    .exercise-item__metric--volume { display: none; }
}

@media (max-width: 800px) {
    .auth-shell { display: block; }
    .cover-panel { min-height: 54vh; margin: 12px; }
    .album-cover { object-position: center 43%; }
    .auth-panel { min-height: auto; padding: 26px 28px; }
    .auth-content { max-width: 480px; padding: 25px 0 45px; }
    .app-header { height: 68px; }
    .live-pill, .header-divider, .user-name { display: none; }
    .app-main { padding-top: 38px; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; }
    .date-navigation { width: 100%; }
    .date-picker { flex: 1; }
    .week-card { padding-right: 12px; padding-left: 12px; }
    .week-days { gap: 5px; }
    .week-day { min-height: 70px; }
    .stats-grid { gap: 10px; }
    .stat-card { min-height: 145px; padding: 18px; }
    .stat-card strong { font-size: 31px; }
    .workout-grid { grid-template-columns: 1fr; }
    .exercise-list { min-height: 250px; max-height: none; }
    .empty-state { min-height: 260px; }
    .exercise-item { grid-template-columns: 45px minmax(100px, 1fr) auto auto auto auto 30px 30px; }
    .exercise-item__metric--volume { display: block; }
}

@media (max-width: 520px) {
    .brand { font-size: 10px; letter-spacing: 1.2px; }
    .cover-panel { min-height: 42vh; }
    .auth-heading h1 { font-size: 52px; }
    .app-header { padding: 0 18px; }
    .app-main { padding: 32px 15px 20px; }
    .dashboard-heading { margin-bottom: 26px; }
    .dashboard-heading h1 { font-size: 38px; letter-spacing: -2.5px; }
    .date-navigation { gap: 5px; }
    .icon-button { width: 39px; }
    .today-button { padding: 0 10px; }
    .week-card { border-radius: 15px; }
    .week-card__heading { padding: 0 5px; }
    .week-day { min-height: 64px; border-radius: 8px; }
    .week-day__name { font-size: 7px; letter-spacing: 0; }
    .week-day__date { font-size: 17px; }
    .week-days { gap: 3px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card:first-child { grid-column: 1 / -1; }
    .stat-card { min-height: 137px; }
    .stat-card:first-child { min-height: 150px; }
    .exercise-form-panel, .exercises-panel { padding: 22px 17px; }
    .exercises-panel { padding-right: 12px; }
    .counter-row { gap: 9px; }
    .counter-field--small { grid-template-columns: 34px 1fr 34px; }
    .exercise-item { grid-template-columns: 38px minmax(80px, 1fr) auto auto auto 26px 26px; gap: 9px; padding-left: 10px; }
    .inline-metric input { width: 48px; }
    .order-input { width: 36px; height: 38px; }
    .exercise-item__metric--volume { display: none; }
    .exercise-item__metric { min-width: 55px; }
    .app-footer span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
