:root {
  --paper: #f7faf8;
  --surface: #ffffff;
  --ink: #172421;
  --muted: #72817c;
  --line: #e2eae5;
  --green: #176b5d;
  --green-soft: #e2f1eb;
  --green-pale: #f0f8f4;
  --sand: #fbf1df;
  --sand-ink: #8c672c;
  --red-soft: #fff0ed;
  --red-ink: #b25b4c;
  --shadow: 0 12px 38px rgba(31, 64, 55, .07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #e9efeb;
}

* { box-sizing: border-box; }
html { background: #e9efeb; }
body { margin: 0; min-width: 320px; background: #e9efeb; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #b9dfd2; outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
h1 { font-size: clamp(30px, 8vw, 43px); line-height: 1.02; margin-bottom: 10px; }
h2 { font-size: 25px; line-height: 1.06; margin-bottom: 6px; }
h3 { font-size: 17px; line-height: 1.1; margin-bottom: 5px; }
.app-shell { width: min(100%, 640px); min-height: 100vh; margin: 0 auto; background: var(--paper); box-shadow: 0 0 44px rgba(35, 62, 52, .10); position: relative; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; position: sticky; top: 0; z-index: 5; background: rgba(247, 250, 248, .93); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(226, 234, 229, .8); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 800; letter-spacing: -.07em; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--green); color: white; font-size: 15px; letter-spacing: 0; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.topbar-date { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 24px; line-height: 1; }
.icon-button:hover { color: var(--green); background: var(--green-pale); }
.page { padding: 28px 17px 100px; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .15em; line-height: 1.2; text-transform: uppercase; margin-bottom: 8px; }
.muted { color: var(--muted); }
.section-title { margin-bottom: 22px; }
.section-title p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0; }
.button { border: 0; border-radius: 13px; min-height: 47px; padding: 13px 16px; font-size: 13px; font-weight: 800; letter-spacing: -.01em; transition: transform .15s, background .15s; }
.button:active { transform: scale(.98); }
.button-dark { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(23, 107, 93, .18); }
.button-dark:hover { background: #0e574c; }
.button-light { color: var(--green); background: var(--green-soft); }
.button-outline { color: var(--green); background: transparent; border: 1px solid #badbd0; }
.button-full { width: 100%; }
.status { display: inline-flex; align-items: center; border-radius: 20px; min-height: 27px; padding: 6px 10px; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.status-done { color: var(--green); background: var(--green-soft); }
.status-sand { color: var(--sand-ink); background: var(--sand); }
.status-red { color: var(--red-ink); background: var(--red-soft); }
.hero { background: var(--green); border-radius: 25px; padding: 25px 21px 21px; color: white; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; width: 210px; height: 210px; position: absolute; right: -90px; top: -100px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 25px rgba(255,255,255,.035), 0 0 0 50px rgba(255,255,255,.035); }
.hero .eyebrow { color: #b9dcd2; }
.hero h1 { max-width: 330px; position: relative; z-index: 1; }
.hero-copy { color: #c7dfd8; font-size: 13px; line-height: 1.45; max-width: 390px; margin-bottom: 20px; position: relative; z-index: 1; }
.hero-status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; z-index: 1; }
.hero .status { color: #d7f0e8; background: rgba(255,255,255,.14); }
.hero .button { color: var(--green); background: white; }
.hero-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 20px 0; position: relative; z-index: 1; }
.hero-meta div { padding: 10px 8px; border: 1px solid rgba(255,255,255,.15); border-radius: 11px; background: rgba(255,255,255,.07); }
.hero-meta strong, .hero-meta small { display: block; }
.hero-meta strong { font-size: 15px; }
.hero-meta small { color: #b9dcd2; font-size: 10px; line-height: 1.25; margin-top: 3px; }
.notice { border: 1px solid #cfe7dd; border-radius: 14px; padding: 13px 14px; color: #4e7167; background: var(--green-pale); font-size: 12px; line-height: 1.45; }
.notice strong { color: var(--green); }
.notice.warning { border-color: #f0ddbb; color: #806740; background: #fffaef; }
.section { margin-top: 27px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }
.text-button { border: 0; background: none; color: var(--green); font-size: 12px; font-weight: 800; padding: 5px 0; }
.exercise-list { display: grid; gap: 10px; }
.exercise-item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 4px 15px rgba(25, 60, 49, .035); }
.exercise-photo { width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: #e8f1ed; }
.exercise-photo img, .machine-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.exercise-main { min-width: 0; }
.exercise-main h3 { font-size: 15px; overflow-wrap: anywhere; }
.exercise-main p { color: var(--muted); font-size: 11px; margin: 3px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exercise-dose { color: var(--ink); font-size: 11px; font-weight: 800; line-height: 1.4; }
.exercise-dose span { color: var(--green); }
.exercise-check { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: white; background: var(--green); font-size: 17px; font-weight: 900; }
.exercise-pending { width: 8px; height: 8px; border-radius: 50%; background: #d4ddd8; margin: 0 10px; }
.next-box { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 17px; }
.next-box h3 { margin-bottom: 5px; }
.next-box p { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 0 0 13px; }
.mini-list { display: grid; gap: 8px; margin: 13px 0 16px; }
.mini-list div { display: flex; align-items: center; gap: 8px; color: #50645d; font-size: 11px; }
.mini-list i { width: 6px; height: 6px; background: #a5d3c5; border-radius: 50%; }
.empty-state { border: 1px dashed #bdd7cd; border-radius: 16px; padding: 25px 16px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.45; background: #fbfefd; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 640px); display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.bottom-nav button { border: 0; background: transparent; color: #84918d; min-height: 52px; border-radius: 12px; display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 10px; font-weight: 700; }
.bottom-nav button span { font-size: 20px; line-height: 1; }
.bottom-nav button.active { color: var(--green); background: var(--green-pale); }
.workout-shell { min-height: calc(100vh - 70px); padding: 17px 17px 35px; display: flex; flex-direction: column; }
.workout-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.back-button { border: 0; background: transparent; color: var(--green); padding: 5px 0; font-size: 13px; font-weight: 800; }
.progress-track { height: 5px; background: #dce9e3; border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.progress-track span { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width .2s; }
.workout-photo { width: 100%; height: clamp(225px, 62vw, 360px); border-radius: 22px; overflow: hidden; background: #e5f0eb; margin-bottom: 20px; }
.workout-photo img { width: 100%; height: 100%; object-fit: cover; }
.workout-heading { margin-bottom: 17px; }
.workout-heading h1 { font-size: clamp(28px, 8.5vw, 42px); margin-bottom: 6px; }
.workout-heading p { color: var(--muted); font-size: 13px; margin: 0; }
.workout-dose { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 19px; }
.dose-box { padding: 13px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; }
.dose-box strong, .dose-box small { display: block; }
.dose-box strong { color: var(--green); font-size: 22px; letter-spacing: -.04em; }
.dose-box small { color: var(--muted); font-size: 10px; font-weight: 700; margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }
.series-block { margin-top: auto; }
.series-block h3 { font-size: 15px; margin-bottom: 10px; }
.series-buttons { display: grid; gap: 8px; }
.series-button { width: 100%; min-height: 50px; border: 1px solid #c8ddd5; border-radius: 13px; color: var(--green); background: white; font-size: 13px; font-weight: 800; text-align: left; padding: 0 16px; }
.series-button.done { border-color: var(--green); color: white; background: var(--green); }
.series-button.done::after { content: "✓"; float: right; font-size: 17px; }
.effort-panel { padding: 15px; border-radius: 17px; background: var(--green-pale); border: 1px solid #cfe7dd; margin-top: 13px; }
.effort-panel h3 { margin-bottom: 4px; }
.effort-panel p { color: var(--muted); font-size: 11px; margin-bottom: 11px; }
.effort-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.effort-button { min-height: 43px; border: 1px solid #c7ddd5; border-radius: 11px; background: white; color: #5c726b; font-size: 11px; font-weight: 800; }
.effort-button.selected { color: white; border-color: var(--green); background: var(--green); }
.summary-card { padding: 24px 19px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.summary-hero { text-align: center; padding: 22px 0 26px; }
.summary-icon { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); font-size: 29px; }
.summary-hero p { color: var(--muted); font-size: 13px; margin: 0; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.summary-stat { padding: 12px 6px; border-radius: 12px; background: var(--green-pale); text-align: center; }
.summary-stat strong, .summary-stat small { display: block; }
.summary-stat strong { color: var(--green); font-size: 19px; }
.summary-stat small { color: var(--muted); font-size: 9px; line-height: 1.2; margin-top: 3px; }
.summary-list { display: grid; gap: 9px; margin-top: 14px; }
.summary-line { display: flex; align-items: start; gap: 9px; font-size: 12px; color: #50645d; line-height: 1.4; }
.summary-line b { color: var(--green); }
.summary-line .dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #a5d3c5; }
.simple-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.kpi { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.kpi small, .kpi strong { display: block; }
.kpi small { color: var(--muted); font-size: 10px; line-height: 1.3; }
.kpi strong { color: var(--ink); font-size: 24px; letter-spacing: -.05em; margin-top: 7px; }
.chart-card { padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.chart-card h3 { margin-bottom: 3px; }
.chart-card p { color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.chart-wrap { height: 150px; }
.chart-wrap svg { display: block; width: 100%; height: 100%; }
.chart-grid { stroke: #e6eee9; stroke-width: 1; }
.chart-fill { fill: #e2f1eb; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: white; stroke: var(--green); stroke-width: 2; }
.chart-labels { display: flex; justify-content: space-between; color: #9aa8a2; font-size: 9px; }
.machine-list { display: grid; gap: 14px; }
.machine-card { border: 1px solid var(--line); border-radius: 19px; overflow: hidden; background: white; box-shadow: 0 4px 16px rgba(25, 60, 49, .035); }
.machine-photo { height: 210px; background: #e8f1ed; }
.machine-content { padding: 15px; }
.machine-content h3 { margin-bottom: 4px; }
.machine-content > p { color: var(--muted); font-size: 12px; margin-bottom: 13px; }
.machine-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.machine-detail { padding: 9px 7px; border-radius: 10px; background: var(--green-pale); }
.machine-detail strong, .machine-detail small { display: block; }
.machine-detail strong { color: var(--green); font-size: 13px; }
.machine-detail small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.machine-note { color: #58716a; background: #f7faf8; padding: 10px; border-radius: 11px; font-size: 11px; line-height: 1.4; margin-bottom: 13px; }
.card-actions { display: flex; gap: 8px; }
.card-actions .button { flex: 1; min-height: 40px; padding: 9px; font-size: 11px; }
.history-list { display: grid; gap: 12px; }
.history-card { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.history-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.history-head h3 { margin: 0; }
.history-date { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px; }
.history-summary { color: var(--muted); font-size: 11px; margin: 10px 0 0; line-height: 1.4; }
.history-exercises { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 11px; margin-top: 12px; }
.history-exercises div { display: flex; justify-content: space-between; gap: 10px; color: #536760; font-size: 11px; }
.history-exercises span:last-child { font-weight: 800; color: var(--green); white-space: nowrap; }
.dialog { width: min(460px, calc(100% - 24px)); max-height: calc(100vh - 24px); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 25px 80px rgba(19, 45, 38, .25); }
.dialog::backdrop { background: rgba(22, 44, 38, .43); backdrop-filter: blur(3px); }
.dialog-card { max-height: calc(100vh - 24px); overflow-y: auto; padding: 21px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
label { display: grid; gap: 6px; color: #50635c; font-size: 11px; font-weight: 800; margin-bottom: 13px; }
label small { color: var(--muted); font-size: 10px; font-weight: 400; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: white; font-size: 13px; font-weight: 400; }
textarea { resize: vertical; line-height: 1.4; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 85px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; min-width: min(300px, calc(100% - 34px)); padding: 12px 14px; border-radius: 12px; color: white; background: #173e36; text-align: center; font-size: 12px; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.desktop-only { display: none; }

@media (min-width: 641px) {
  .page { padding-left: 28px; padding-right: 28px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .desktop-only { display: block; }
}

@media (max-width: 380px) {
  .hero-meta strong { font-size: 13px; }
  .exercise-item { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 9px; }
  .exercise-photo { width: 76px; height: 76px; }
  .machine-details { gap: 4px; }
}
