:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --ok: #166534;
  --warn: #92400e;
  --danger: #991b1b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(17,24,39,.06);
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100dvh; background: radial-gradient(circle at 50% -120px, #e8eef6 0, var(--bg) 420px); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):active { transform: scale(.98); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .file-button:focus-within { outline: 3px solid #2563eb; outline-offset: 3px; }
input, select { font-size: 16px; }
.app-shell { min-height: 100dvh; padding: calc(10px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.header { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 18px 4px 12px; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
h1 { margin: 0; font-size: 30px; line-height: 1.05; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid rgba(229,231,235,.85); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.hero { padding: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.badge.done { background: #ecfdf5; color: var(--ok); border-color: #bbf7d0; }
.badge.pending { background: #fff7ed; color: var(--warn); border-color: #fed7aa; }
.progress { display:block; width:100%; height:10px; border:0; border-radius:999px; background:var(--soft); overflow:hidden; margin-top:14px; appearance:none; }
.progress::-webkit-progress-bar { background:var(--soft); border-radius:999px; }
.progress::-webkit-progress-value { background:var(--ink); border-radius:999px; transition:width .2s ease; }
.progress::-moz-progress-bar { background:var(--ink); border-radius:999px; }
.exercise-list { display: grid; gap: 10px; }
.exercise { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.exercise-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px; }
.exercise-title { font-weight: 800; }
.exercise-target { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sets { display: grid; gap: 8px; }
.set-row { display:grid; grid-template-columns: 34px 1fr auto; align-items:center; gap:8px; }
.set-index { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; background:var(--soft); font-weight:800; font-size:13px; }
.stepper { display:grid; grid-template-columns: 44px 1fr 44px; border:1px solid var(--line); border-radius:12px; overflow:hidden; min-height:46px; }
.stepper button { border:0; background:var(--soft); font-size:22px; color:var(--ink); min-width:44px; }
.stepper output { display:grid; place-items:center; font-weight:800; background:#fff; }
.check { width:44px; height:44px; border-radius:12px; border:1px solid var(--line); background:#fff; font-weight:900; font-size:18px; }
.check.is-done { background:var(--ink); color:#fff; border-color:var(--ink); }
.primary, .secondary, .ghost, .danger { border: 0; border-radius: 14px; min-height: 50px; padding: 0 16px; font-weight: 800; transition: transform .08s ease, opacity .2s ease; }
.primary { background: var(--ink); color: #fff; }
.secondary { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.actions .wide { grid-column: 1 / -1; }
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(calc(100% - 20px), 720px); background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border: 1px solid rgba(229,231,235,.95); border-radius: 20px; box-shadow: 0 18px 50px rgba(17,24,39,.12); display:grid; grid-template-columns:repeat(4,1fr); overflow:hidden; z-index:20; }
.nav button { min-height:62px; border:0; background:transparent; color:var(--muted); font-size:11px; font-weight:800; }
.nav button span { display:block; font-size:20px; margin-bottom:2px; }
.nav button.active { color:var(--ink); background:var(--soft); }
.history-item { display:grid; grid-template-columns:52px 1fr auto; gap:12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); }
.history-item:last-child { border-bottom:0; }
.daybox { width:52px; height:52px; border-radius:14px; display:grid; place-items:center; background:var(--soft); font-weight:800; }
.daybox small { display:block; color:var(--muted); font-size:10px; font-weight:700; }
.metric-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.metric { border:1px solid var(--line); border-radius:16px; padding:14px; background:#fff; }
.metric strong { display:block; font-size:28px; letter-spacing:-.04em; }
.metric span { color:var(--muted); font-size:12px; }
.bar-row { display:grid; grid-template-columns:86px 1fr 58px; gap:10px; align-items:center; margin:10px 0; }
.bar { width:100%; height:10px; border:0; border-radius:999px; background:var(--soft); overflow:hidden; appearance:none; }
.bar::-webkit-progress-bar { background:var(--soft); border-radius:999px; }
.bar::-webkit-progress-value { background:var(--ink); border-radius:999px; }
.bar::-moz-progress-bar { background:var(--ink); border-radius:999px; }
.stats-volume { margin-top:12px; }
.field { display:grid; gap:7px; margin-top:12px; }
.field label { font-size:12px; font-weight:800; color:var(--muted); }
.field input, .field select { width:100%; min-height:48px; border:1px solid var(--line); border-radius:12px; background:#fff; color:var(--ink); padding:0 12px; }
.note { font-size:12px; line-height:1.55; color:var(--muted); }
.sync-summary { margin:0; color:var(--muted); text-align:center; font-size:12px; line-height:1.5; }
.file-button { display:grid; place-items:center; cursor:pointer; }
.full-button { width:100%; margin-top:12px; }
.statusline { display:flex; align-items:center; gap:8px; font-size:13px; margin:8px 0 0; }
.dot { width:9px; height:9px; border-radius:50%; background:#9ca3af; }
.dot.ok { background:#16a34a; }
.dot.warn { background:#d97706; }
.empty { text-align:center; padding:34px 16px; color:var(--muted); }
.not-found { display:grid; place-items:center; padding-bottom:calc(20px + env(safe-area-inset-bottom)); }
.not-found .card { width:min(100%, 440px); margin:0; }
.not-found-link { display:inline-flex; align-items:center; justify-content:center; margin-top:12px; text-decoration:none; }
.toast { position:fixed; left:50%; bottom:96px; transform:translate(-50%,16px); opacity:0; pointer-events:none; background:#111827; color:#fff; padding:10px 14px; border-radius:12px; font-size:13px; font-weight:700; transition:.2s; z-index:50; max-width:calc(100% - 40px); text-align:center; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.offline-banner { position:sticky; top:0; z-index:40; background:#fff7ed; color:var(--warn); border-bottom:1px solid #fed7aa; padding:calc(8px + env(safe-area-inset-top)) 12px 8px; text-align:center; font-size:12px; font-weight:800; }
.update-banner { position:fixed; left:50%; top:calc(12px + env(safe-area-inset-top)); transform:translateX(-50%); z-index:60; width:min(calc(100% - 28px), 480px); border:1px solid #bfdbfe; border-radius:14px; background:#eff6ff; color:#1e3a8a; box-shadow:var(--shadow); padding:10px 12px; align-items:center; justify-content:space-between; gap:12px; font-size:13px; font-weight:800; }
.update-banner:not([hidden]) { display:flex; }
.update-banner button { min-height:44px; border:0; border-radius:10px; padding:0 14px; background:#1e3a8a; color:#fff; font-weight:800; }
details { border-top:1px solid var(--line); margin-top:12px; padding-top:12px; }
summary { cursor:pointer; font-weight:800; min-height:44px; display:flex; align-items:center; }
code.inline { background:var(--soft); border:1px solid var(--line); border-radius:7px; padding:2px 5px; font-size:12px; }
.keyboard-open .nav { display:none; }
.keyboard-open .app-shell { padding-bottom:calc(20px + env(safe-area-inset-bottom)); }
.update-available .app-shell { padding-top:calc(88px + env(safe-area-inset-top)); }
@media (min-width: 680px) {
  .exercise-list { grid-template-columns:1fr 1fr; }
  .metric-grid { grid-template-columns:repeat(4,1fr); }
}
@media (max-width: 390px) {
  .app-shell { padding-left:10px; padding-right:10px; }
  .card { padding:14px; }
  .set-row { grid-template-columns:30px minmax(0, 1fr) 44px; gap:6px; }
  .set-index { width:30px; }
  .actions { grid-template-columns:1fr; }
  .actions .wide { grid-column:auto; }
  h1 { font-size:28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; }
}
