/* Lift Craft — plain CSS, no build step. Look follows the MVP design: orange accent, warm greys, 12px radii,
   inset borders instead of shadows. */
:root {
    color-scheme: light;
    --canvas: #f1f1f1;
    --surface: #ffffff;
    --ink: #000000;
    --muted: rgba(0, 0, 0, 0.6);
    --line: #ebebeb;
    --brand: #ff610f;
    --brand-press: #f3550f;
    --brand-ink: #b83f00;
    --brand-soft: #ffeadf;
    --good: #0d402b;
    --good-soft: #e9f6f0;
    --good-solid: #21a16b;
    --warn: #664800;
    --warn-soft: #fff0cc;
    --bad: #81091f;
    --bad-soft: #fbe7eb;
    --info: #164d81;
    --info-soft: #e9f2fb;
    --radius: 12px;
    --font: "Roboto", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 36px; font-weight: 600; }
h2 { font-size: 20px; line-height: 28px; font-weight: 600; }
h3, .h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0 0 8px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 18px; }
.tiny { font-size: 12px; line-height: 16px; }
.strong { font-weight: 600; }
.medium-weight { font-weight: 500; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.big { display: block; font-size: 24px; line-height: 32px; font-weight: 600; }
.link { color: var(--brand-ink); font-weight: 500; }
.link:hover { text-decoration: underline; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; flex-wrap: nowrap; }
.row.center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.narrow { max-width: 560px; }

/* Shell: side rail on desktop, top bar on phones. */
.shell { display: flex; min-height: 100vh; }
.rail { flex: none; width: 240px; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); display: flex; flex-direction: column; padding: 20px 0; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; font-size: 18px; font-weight: 600; }
.nav { list-style: none; margin: 0; padding: 0 8px 0 0; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 0 999px 999px 0; font-weight: 500; }
.nav a:hover { background: rgba(0, 0, 0, .04); }
.nav a[aria-current] { background: #ffddcc; color: #662200; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; box-shadow: inset 0 1px 0 var(--line); flex-wrap: wrap; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.me-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.link-button:hover { color: var(--ink); text-decoration: underline; }
.content { flex: 1; min-width: 0; padding: 32px 24px 48px; max-width: 1180px; display: flex; flex-direction: column; gap: 20px; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head > div { display: flex; flex-direction: column; gap: 6px; }
.back { color: var(--muted); font-size: 14px; }
.back:hover { color: var(--ink); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.pad { padding: 20px; }
.pad-s { padding: 16px; }
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; }

.notice { padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.notice-success { background: var(--good-soft); color: var(--good); }
.notice-error { background: var(--bad-soft); color: var(--bad); }
.notice-info { background: var(--info-soft); color: var(--info); }
.link-notice { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.link-notice > div { flex: 1 1 360px; display: flex; flex-direction: column; gap: 6px; }

.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px; white-space: nowrap; background: rgba(0, 0, 0, .06); color: rgba(0, 0, 0, .75); }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: var(--radius); border: 0; font: 500 14px/24px var(--font); letter-spacing: .4px; text-transform: uppercase; cursor: pointer; transition: background 120ms cubic-bezier(.2, 0, 0, 1); white-space: nowrap; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-press); }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.btn-secondary:hover { background: rgba(0, 0, 0, .04); }
.btn-danger { background: transparent; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-large { min-height: 48px; }
.btn-block { width: 100%; }
.btn:focus-visible, .input:focus-visible, a:focus-visible, .chip input:focus-visible + span, .done-toggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.input { width: 100%; min-height: 44px; border: 0; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); padding: 0 12px; font: 400 16px/24px var(--font); color: var(--ink); }
textarea.input { padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.input::placeholder { color: rgba(0, 0, 0, .38); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row > div { flex: 0 1 200px; }
.form-row > .grow { flex: 1 1 280px; }

.bar { height: 6px; border-radius: 999px; background: rgba(0, 0, 0, .08); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); transition: width 200ms cubic-bezier(.2, 0, 0, 1); }

/* Catalog */
.current { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.current-text { flex: 1 1 360px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.catalog { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.filters { flex: 1 1 240px; max-width: 280px; display: flex; flex-direction: column; gap: 18px; }
.results { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); font-size: 13px; cursor: pointer; user-select: none; }
.chip span:hover { background: rgba(0, 0, 0, .04); }
.chip input:checked + span { background: var(--brand-soft); color: #662200; box-shadow: inset 0 0 0 1px var(--brand); }
.program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.program-card { display: flex; flex-direction: column; gap: 10px; min-height: 180px; transition: box-shadow 200ms cubic-bezier(.2, 0, 0, 1); }
.program-card:hover { box-shadow: inset 0 0 0 1px var(--line), 0 4px 12px rgba(0, 0, 0, .12); }
.program-card .badges { margin-top: auto; }
.facts { display: flex; gap: 14px; flex-wrap: wrap; }

/* Program detail */
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.main-column { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.main-column > section { display: flex; flex-direction: column; gap: 12px; }
.side-column { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 8px; background: var(--canvas); }
.stat span { font-size: 12px; color: var(--muted); }
.stat strong { font-size: 20px; line-height: 28px; }
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.block { display: flex; flex-direction: column; gap: 2px; }
.block.is-current { box-shadow: inset 0 0 0 2px var(--brand); }
.weeks { display: flex; flex-wrap: wrap; gap: 4px; }
.weeks a { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.weeks a[aria-current] { background: var(--brand); color: #fff; box-shadow: none; }
.workout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.workout-grid article { display: flex; flex-direction: column; gap: 12px; }
.workout-grid article.is-next { box-shadow: inset 0 0 0 2px var(--brand); }
.exercise-line, .exercise-head { display: flex; gap: 10px; align-items: flex-start; }
.letter { flex: none; width: 24px; height: 24px; border-radius: 999px; background: var(--canvas); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Workout logging (phone first) */
.session { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.session-head { display: flex; flex-direction: column; gap: 10px; }
.session-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; }
.session-progress .bar { grid-column: 1; }
.session-progress [data-save-state] { grid-column: 1 / -1; min-height: 16px; }
.exercise { display: flex; flex-direction: column; gap: 10px; }
.note { padding: 8px 10px; border-radius: 8px; background: var(--info-soft); color: var(--info); font-size: 12px; line-height: 16px; }
.set-grid { display: grid; grid-template-columns: 28px repeat(3, minmax(0, 1fr)) 44px; gap: 6px; align-items: center; }
.set-grid-head { font-size: 11px; line-height: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.set-grid-head span:last-child { text-align: center; }
.set-row { padding: 4px; margin: 0 -4px; border-radius: 10px; transition: background 120ms; }
.set-row.is-done { background: var(--good-soft); }
.set-row .input { padding: 0 8px; font-weight: 500; }
.set-no { font-weight: 600; text-align: center; }
.done-toggle { position: relative; }
.done-toggle input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.done-toggle span[aria-hidden] { width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--surface); color: rgba(0, 0, 0, .38); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); font-size: 18px; font-weight: 700; pointer-events: none; }
.done-toggle input:checked + span { background: var(--good-solid); color: #fff; box-shadow: none; }
.session-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: flex-end; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--canvas) 24px); }
.session-actions .btn-primary { flex: 1; max-width: 320px; }
.rest-timer { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius); background: #212121; color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.rest-timer[hidden] { display: none; }
.rest-timer .muted { color: rgba(255, 255, 255, .7); }
.rest-main { display: flex; align-items: baseline; gap: 10px; }
.rest-time { font-size: 32px; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rest-timer .btn-secondary { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.rest-timer .btn-secondary:hover { background: rgba(255, 255, 255, .2); }
.rest-timer.is-over { background: var(--good-solid); }
.delete-session { max-width: 720px; display: flex; justify-content: center; }

/* Log & users tables */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tiles > section { display: flex; flex-direction: column; gap: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 12px; box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
td { padding: 12px; box-shadow: inset 0 -1px 0 var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
table.compact td { padding-top: 8px; padding-bottom: 8px; }
tr.is-done td { background: var(--good-soft); }
tr.is-removed td { color: var(--muted); }
.input-small { min-height: 36px; width: 90px; padding: 0 8px; font-size: 14px; }
table.variations td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }

/* Maxes: Squat / Bench / Deadlift tabs. Radio buttons keep every panel in one form, so switching tabs loses no edits. */
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.tab-list { display: flex; gap: 4px; padding: 0 16px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; }
.tab-list label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; font-weight: 500; font-size: 14px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); cursor: pointer; box-shadow: inset 0 -2px 0 transparent; white-space: nowrap; }
.tab-list label:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, .06); font-size: 12px; line-height: 20px; text-align: center; letter-spacing: 0; }
.tab-panel { display: none; }
#tab-squat:checked ~ .tab-panel-squat, #tab-bench:checked ~ .tab-panel-bench, #tab-deadlift:checked ~ .tab-panel-deadlift { display: block; }
#tab-squat:checked ~ .tab-list label[for="tab-squat"], #tab-bench:checked ~ .tab-list label[for="tab-bench"], #tab-deadlift:checked ~ .tab-list label[for="tab-deadlift"] { color: var(--brand-ink); box-shadow: inset 0 -2px 0 var(--brand); }
#tab-squat:checked ~ .tab-list label[for="tab-squat"] .tab-count, #tab-bench:checked ~ .tab-list label[for="tab-bench"] .tab-count, #tab-deadlift:checked ~ .tab-list label[for="tab-deadlift"] .tab-count { background: var(--brand-soft); }
#tab-squat:focus-visible ~ .tab-list label[for="tab-squat"], #tab-bench:focus-visible ~ .tab-list label[for="tab-bench"], #tab-deadlift:focus-visible ~ .tab-list label[for="tab-deadlift"] { outline: 2px solid var(--brand); outline-offset: -2px; }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.login .hint { padding: 12px; border-radius: 8px; background: var(--canvas); color: var(--muted); }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .rail { width: auto; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
    .brand { padding: 0 8px 0 0; font-size: 16px; }
    .brand img { width: 28px; height: 28px; }
    .nav { flex-direction: row; overflow-x: auto; padding: 0; order: 3; width: 100%; }
    .nav a { border-radius: 999px; padding: 0 14px; white-space: nowrap; min-height: 40px; }
    .me { margin: 0 0 0 auto; padding: 0; box-shadow: none; }
    .me-name { display: none; }
    .content { padding: 16px 12px 32px; }
    h1 { font-size: 22px; line-height: 30px; }
    .filters { max-width: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .side-column { max-width: none; position: static; }
    .session-actions .btn-secondary { padding: 0 12px; }
    .session-actions .btn-primary { flex: 1 1 100%; max-width: none; order: 9; }
}
