:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #6d7873;
  --paper: #f5f7f4;
  --card: #ffffff;
  --line: #e2e8e3;
  --green: #1f7457;
  --green-dark: #15513d;
  --mint: #e4f2eb;
  --orange: #d8863a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px max(18px, calc((100vw - 720px)/2)); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: var(--ink); color: #fff; border-radius: 13px; font-weight: 800; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .2px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.save-status { font-size: 12px; color: var(--muted); }
.app-shell { width: min(100% - 32px, 680px); margin: 0 auto; padding: 27px 0 28px; }
.view { display: none; animation: appear .18s ease-out; }
.view.active { display: block; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.welcome { padding: 14px 3px 18px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; margin: 0 0 8px; }
h1 { font-size: clamp(27px, 7vw, 36px); letter-spacing: -1.1px; line-height: 1.08; margin: 0 0 10px; }
.welcome > p:last-child, .section-heading > p:last-child { color: var(--muted); margin: 0; line-height: 1.5; }
.day-list { display: grid; gap: 11px; }
.day-card { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; color: var(--ink); box-shadow: 0 2px 5px rgba(21,41,31,.025); }
.day-card:active { transform: scale(.99); }
.day-index { flex: 0 0 43px; height: 43px; display: grid; place-items: center; border-radius: 14px; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: 800; }
.day-card-copy { min-width: 0; flex: 1; }
.day-card-copy strong, .day-card-copy small { display: block; }
.day-card-copy strong { font-size: 15px; }
.day-card-copy small { color: var(--muted); margin-top: 4px; line-height: 1.35; }
.card-arrow { color: #97a29b; font-size: 22px; }
.privacy-note { padding: 16px 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-heading { padding: 14px 2px 20px; }
.back-button, .text-button { border: 0; background: none; color: var(--green-dark); padding: 8px 0; font-weight: 650; }
.back-button { margin-bottom: 12px; }
.date-field, .select-field { display: grid; gap: 7px; margin: 14px 0; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,116,87,.12); }
.exercise-card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; margin: 12px 0; padding: 16px; }
.exercise-title-row { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; margin-bottom: 13px; }
.exercise-title-row h2 { font-size: 17px; margin: 0; }
.exercise-title-row p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.set-header, .set-row { display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px; align-items: center; }
.set-header { color: var(--muted); font-size: 11px; font-weight: 700; padding: 0 2px 6px; }
.set-row { margin: 6px 0; }
.set-number { color: var(--muted); font-size: 13px; font-weight: 700; }
.set-row input { min-height: 42px; padding: 8px; text-align: center; }
.field-label { font-size: 12px; font-weight: 700; display: grid; gap: 6px; margin-top: 12px; }
.exercise-footer { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.exercise-footer label { min-width: 0; }
.exercise-footer select { font-size: 12px; padding: 8px; }
textarea { min-height: 65px; resize: vertical; }
.primary-button, .secondary-button, .danger-button { min-height: 46px; border-radius: 12px; padding: 11px 15px; font-weight: 750; border: 1px solid transparent; }
.primary-button { background: var(--green); color: #fff; }
.primary-button:active { background: var(--green-dark); }
.secondary-button { background: var(--mint); color: var(--green-dark); }
.danger-button { background: #fff4ef; color: #a34224; border-color: #f5d5c8; }
.full-width { width: 100%; margin-top: 10px; }
.empty-state { padding: 22px; border: 1px dashed #cbd7ce; background: rgba(255,255,255,.7); border-radius: 16px; color: var(--muted); text-align: center; line-height: 1.5; }
.history-list { display: grid; gap: 10px; }
.history-card { padding: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.history-card strong { display: block; }
.history-card p { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.routine-day-editor { display: grid; gap: 9px; }
.rest-toggle { display: flex; align-items: center; gap: 11px; padding: 14px; margin: 8px 0 14px; background: var(--mint); border-radius: 14px; cursor: pointer; }
.rest-toggle input { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--green); flex: 0 0 auto; }
.rest-toggle strong, .rest-toggle small { display: block; }
.rest-toggle strong { font-size: 13px; }
.rest-toggle small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.routine-row { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.routine-row-main { display: grid; gap: 7px; }
.routine-row-main input { min-height: 40px; }
.routine-row-settings { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 7px; }
.routine-row-settings label { display: grid; gap: 4px; font-size: 10px; color: var(--muted); }
.routine-row-settings input, .routine-row-settings select { min-height: 38px; padding: 6px; font-size: 12px; }
.routine-actions { display: flex; flex-direction: column; gap: 5px; }
.icon-button { min-width: 36px; min-height: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.icon-button.delete { color: #a34224; }
.add-exercise-form { margin-top: 22px; padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.add-exercise-form h2 { font-size: 16px; margin: 0 0 13px; }
.add-exercise-form label { display: grid; gap: 6px; margin-bottom: 11px; font-size: 12px; font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.backup-reminder { margin-top: 18px; border-radius: 14px; padding: 15px; background: #fff3e6; color: #69451f; font-size: 12px; line-height: 1.5; }
.backup-reminder p { margin: 6px 0 0; }
.bottom-nav { position: fixed; z-index: 8; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4,1fr); padding: 8px max(8px, calc((100vw - 680px)/2)) calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.nav-item { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 10px; border: 0; background: transparent; padding: 3px; }
.nav-item span { font-size: 20px; line-height: 22px; }
.nav-item.active { color: var(--green-dark); font-weight: 800; }
.toast { position: fixed; z-index: 12; bottom: calc(80px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; transition: .2s; width: max-content; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
@media (min-width: 700px) { .day-list { grid-template-columns: 1fr 1fr; } .day-card { min-height: 92px; } }
