:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #121821;
  --muted: #5d6673;
  --border: #e1e4e9;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fde8dc;
  --ok: #1f9d55;
  --ok-soft: #dcf3e6;
  --bad: #c92a2a;
  --chart: #e8590c;
  --chart-track: #f6d9c8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --surface: #18222e;
    --surface-2: #223040;
    --text: #eef2f6;
    --muted: #9aa7b6;
    --border: #2a394a;
    --accent: #ff7a33;
    --accent-ink: #1a0d05;
    --accent-soft: #3a2316;
    --ok: #3ccf7f;
    --ok-soft: #173a29;
    --bad: #ff6b6b;
    --chart: #e66a1e;
    --chart-track: #5a3f2e;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.timer-on { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1em; }
p { margin: 0 0 .6em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1.2rem; }
.lead { font-size: 1.05rem; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand img { border-radius: 7px; }
.container { max-width: 1100px; margin: 0 auto; padding: 16px; outline: none; }
.page-title { margin-top: 4px; }
.grid-2 { display: grid; gap: 0; }
.ex-grid { display: grid; gap: 0; }
@media (min-width: 760px) {
  .container { padding: 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; }
  .ex-grid { grid-template-columns: 1fr 1fr; gap: 0 16px; }
}
@media (min-width: 1100px) {
  .ex-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.hero { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.hero h1 { font-size: 2.2rem; margin-bottom: 0; }
.hero-title { font-size: 1.2rem; font-weight: 600; margin: 2px 0 4px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; margin-top: 10px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.icon-btn {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 600 .95rem/1 inherit; text-decoration: none; cursor: pointer;
}
.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-weight: 600; }

/* Progress */
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.dots { display: grid; gap: 6px; }
.dot-row { display: flex; gap: 6px; align-items: center; }
.dot-label { width: 28px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.dot {
  flex: 1; height: 32px; max-width: 80px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 700; text-decoration: none;
}
.dot.on { background: var(--ok); color: #fff; }

/* Schedule */
.schedule { list-style: none; padding: 0; margin: 0 0 8px; }
.schedule li { display: flex; gap: 12px; padding: 8px 10px; border-radius: 10px; }
.schedule li .day { width: 34px; font-weight: 700; color: var(--muted); flex: none; }
.schedule li.session { font-weight: 600; }
.schedule li.today { background: var(--accent-soft); }
.schedule li.today .day { color: var(--accent); }

/* Program */
.week { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.week h3 { margin: 0 0 2px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: 12px; background: var(--surface-2);
  text-decoration: none; color: var(--text);
}
.tile-id { font-size: 1.3rem; font-weight: 800; }
.tile-name { font-size: .75rem; color: var(--muted); }
.tile.done { background: var(--ok-soft); }
.tile .check { position: absolute; top: 4px; right: 8px; color: var(--ok); font-weight: 800; }

/* Session */
.session-head h1 { font-size: 1.5rem; }
.banner { padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.note p:last-child { margin-bottom: 0; }
details.card summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "▾"; color: var(--muted); transition: transform .2s; }
details.card:not([open]) summary::after { transform: rotate(-90deg); }
details.card summary h2 { margin: 0; }
.routine { list-style: none; padding: 0; margin: 8px 0 0; }
.routine li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.routine li:last-child { border-bottom: 0; }
.routine .link { font-weight: 600; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.routine li > span { text-align: right; }
.section-label { margin: 8px 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.section-label .small { font-weight: 400; }

.ex { transition: border-color .2s, background .2s; }
.ex.complete { border-color: var(--ok); background: color-mix(in srgb, var(--ok-soft) 50%, var(--surface)); }
.ex-head { display: flex; gap: 12px; align-items: flex-start; }
.num {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.ex.complete .num { background: var(--ok); color: #fff; }
.ex-title { flex: 1; min-width: 0; }
.ex-name { font-weight: 700; font-size: 1.05rem; }
.rx { margin: 10px 0; font-weight: 600; font-size: .95rem; }
.finish .field { display: block; margin: 10px 0; font-weight: 600; }
.finish input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 8px; }
.rpe-val { color: var(--accent); font-size: 1.2rem; }
textarea, input[type=number], input[type=search], input[type=text], input[type=time], input[type=date] {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-top: 6px;
}
.notes { white-space: pre-wrap; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 8px; }

/* Library */
.search { margin: 0 0 16px; }
.lib { list-style: none; padding: 0; margin: 0; }
.lib-item {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%;
  padding: 10px 0; background: none; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.lib li:last-child .lib-item { border-bottom: 0; }
.lib-item > span:first-child { font-weight: 600; }
@media (min-width: 760px) {
  .lib { columns: 2; column-gap: 24px; }
  .lib li { break-inside: avoid; }
}

/* Progress view */
.test { padding: 12px 0; border-bottom: 1px solid var(--border); }
.test:last-child { border-bottom: 0; }
.test-info { display: flex; flex-direction: column; margin-bottom: 6px; }
.test-inputs { display: grid; grid-template-columns: 1fr 1fr 64px; gap: 10px; align-items: end; }
.test-inputs label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.delta-wrap { text-align: center; padding-bottom: 10px; }
.delta { font-weight: 800; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
@media (min-width: 760px) {
  .test { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: center; }
  .test-info { margin: 0; }
}
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.log li a { color: var(--text); text-decoration: none; }
.log .notes { width: 100%; }

.bullets { padding-left: 1.2em; margin: 0; }
.bullets li { margin-bottom: 6px; }
.warn { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

/* Bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 40; pointer-events: none; visibility: hidden; transition: visibility 0s .25s; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + var(--safe-b));
  transform: translateY(100%); transition: transform .25s ease;
}
.sheet.open { pointer-events: auto; visibility: visible; transition: none; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-close { position: absolute; top: 16px; right: 16px; }
.sheet-body h2 { font-size: 1.4rem; padding-right: 40px; }
.options { display: grid; gap: 8px; margin: 16px 0; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 6px; }
.tag.easy { background: var(--ok-soft); color: var(--ok); }
.tag.hard { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 760px) {
  .sheet-panel { left: 50%; right: auto; width: 560px; bottom: 50%; border-radius: 20px; transform: translate(-50%, 60%); opacity: 0; transition: transform .25s, opacity .2s; }
  .sheet.open .sheet-panel { transform: translate(-50%, 50%); opacity: 1; }
}

/* Timer */
.timer {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  max-width: 560px; margin: 0 auto;
  background: var(--text); color: var(--bg);
  border-radius: 16px; overflow: hidden;
  transform: translateY(calc(100% + var(--tabbar-h) + var(--safe-b) + 24px));
  visibility: hidden;
  transition: transform .25s, visibility 0s .25s;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.timer.show { transform: none; visibility: visible; transition: transform .25s; }
.t-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); opacity: .35; }
.t-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; }
.t-text { display: flex; flex-direction: column; min-width: 0; }
.t-label { font-size: .8rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-time { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.t-btns { display: flex; gap: 6px; flex: none; }
.timer .btn { background: rgba(127,127,127,.25); border-color: transparent; color: inherit; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 64px); z-index: 50;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-weight: 600; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.tabbar .ti { font-size: 1.25rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- v2: coach, logging, progress ---------- */
.top-actions { display: flex; gap: 8px; }
.coach { border-left: 4px solid var(--accent); }
.coach-sub { border-left-color: var(--border); }
.coach-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.avatar { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); align-items: center; justify-content: center; font-size: .85rem; flex: none; }
.coach-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: 12px; font-size: .92rem; }

.tiles-3, .tiles-4 { display: grid; gap: 10px; margin-bottom: 16px; grid-template-columns: repeat(3, 1fr); }
.tiles-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .tiles-4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.mini-stats div { display: flex; flex-direction: column; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 8px 4px; }
.mini-stats strong { font-size: 1.2rem; }
.mini-stats span { font-size: .72rem; color: var(--muted); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; }
.day-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 12px; background: var(--surface-2); font-size: .75rem; color: var(--muted); font-weight: 600; }
.day-cell b { height: 22px; width: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.day-cell.done b { background: var(--ok); color: #fff; }
.day-cell.missed b { background: transparent; color: var(--bad); border: 2px solid var(--bad); }
.day-cell.planned b { color: var(--accent); }
.day-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--text); }

.preview { list-style: none; padding: 0; margin: 8px 0 0; font-size: .92rem; columns: 1; }
@media (min-width: 560px) { .preview { columns: 2; column-gap: 24px; } }
.preview li { padding: 3px 0; break-inside: avoid; }

/* Check-in */
.q { margin: 12px 0; }
.q-label { font-weight: 600; margin-bottom: 6px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale-btn { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 700 1rem/1 inherit; cursor: pointer; }
.scale-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.scale-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 3px; }

/* Exercise cards & set logging */
.ex-head { align-items: center; }
.swap-btn { flex: none; }
.last { margin: -4px 0 8px; }
.sets { display: flex; flex-direction: column; gap: 6px; }
.set-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 12px; }
.set-row.done { background: color-mix(in srgb, var(--ok-soft) 70%, transparent); }
.set-n { width: 22px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.set-desc { flex: 1; font-size: .92rem; }
.step { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 700 1.2rem/1 inherit; cursor: pointer; }
.set-val { width: 64px !important; margin: 0 !important; text-align: center; font-weight: 700; padding: 8px 4px !important; -moz-appearance: textfield; }
.set-val::-webkit-outer-spin-button, .set-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-unit { font-size: .8rem; color: var(--muted); flex: 1; }
.set-check {
  width: 44px; height: 44px; flex: none; margin-left: auto; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface); color: var(--muted);
  font: 800 1.1rem/1 inherit; cursor: pointer;
}
.set-check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.hold { margin-top: 10px; }
.feedback { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 600 .9rem/1 inherit; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.section-label { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 4px; }
.section-label h2 { margin: 0; }

/* Library ladders */
.lib-grid { display: grid; gap: 0 16px; }
@media (min-width: 760px) { .lib-grid { grid-template-columns: 1fr 1fr; } }
.rungs { list-style: none; padding: 0; margin: 10px 0 0; }
.rungs li { display: flex; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 10px; }
.rungs li.mine { background: var(--accent-soft); }
.rung-lv { flex: none; width: 34px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.rung-ex { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.rung-ex a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; font-weight: 500; }
.rungs.swap li { align-items: center; border-bottom: 1px solid var(--border); border-radius: 0; }
.rungs.swap .chip { min-height: 36px; }

/* Meter */
.meter { display: inline-flex; gap: 3px; flex: none; }
.meter i { width: 10px; height: 14px; border-radius: 3px; background: var(--chart-track); }
.meter i.on { background: var(--chart); }

/* Columns */
.cols { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-top: 18px; border-bottom: 1px solid var(--border); }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; cursor: default; }
.col-bar { width: 100%; max-width: 24px; min-height: 2px; background: var(--chart); border-radius: 4px 4px 0 0; }
.col-val { font-size: .75rem; font-weight: 700; color: var(--text); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.col-label { position: absolute; bottom: -20px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.cols + * { margin-top: 28px; }
.card > .cols:last-child { margin-bottom: 22px; }

/* Trend line */
.trend { width: 100%; height: auto; display: block; margin: 8px 0; overflow: visible; }
.trend .grid { stroke: var(--border); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 10px; }
.trend .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .pt { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.trend .end-label { fill: var(--text); font-size: 12px; font-weight: 700; }

/* Calendar */
.cal { display: grid; grid-template-columns: auto repeat(7, 1fr); gap: 4px; align-items: center; margin-top: 8px; }
.cal-head { text-align: center; font-size: .7rem; color: var(--muted); font-weight: 700; }
.cal-week { font-size: .7rem; color: var(--muted); padding-right: 6px; white-space: nowrap; }
.cal-cell { display: block; aspect-ratio: 1; max-height: 40px; width: 100%; max-width: 40px; justify-self: center; border-radius: 6px; background: var(--surface-2); }
.cal-cell.done { background: var(--chart); }
.cal-cell.missed { background: transparent; box-shadow: inset 0 0 0 2px var(--bad); }
.cal-cell.planned { background: transparent; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--chart) 60%, transparent); }
.cal-cell.today { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cal-cell { width: 12px; height: 12px; border-radius: 3px; }

/* Levels / PRs / badges */
.levels-grid { display: grid; gap: 0 24px; }
@media (min-width: 760px) { .levels-grid { grid-template-columns: repeat(3, 1fr); } }
.levels { list-style: none; padding: 0; margin: 0 0 8px; }
.levels li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.levels li a { display: flex; flex-direction: column; color: var(--text); text-decoration: none; min-width: 0; }
.levels li a span:first-child { font-weight: 600; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.plain li:last-child { border-bottom: 0; }
.pr-list li { display: flex; justify-content: space-between; gap: 10px; }
.pr-list a { color: var(--text); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px 8px; border-radius: 14px; background: var(--surface-2); opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; background: var(--accent-soft); }
.badge span { font-size: 1.6rem; }
.badge small { color: var(--muted); font-size: .72rem; }

/* Forms */
.form .field { display: block; margin: 12px 0; font-weight: 600; }
.grid-2.tight { gap: 0 16px; }
.tag:not(.easy):not(.hard) { background: var(--surface-2); }

/* Tooltip */
.tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px;
  font-size: .8rem; font-weight: 600; max-width: 260px;
}
.tip.show { opacity: 1; }

/* ---------- v3: blocks & weights ---------- */
.block-head { margin: 24px 4px 12px; }
.block-head h2 { font-size: 1.4rem; margin-bottom: 2px; }
.set-row.loaded { gap: 6px; }
.set-wt { width: 64px !important; margin: 0 !important; text-align: center; font-weight: 700; padding: 8px 4px !important; }
.set-row.loaded .set-unit { flex: none; }
.set-row.loaded .set-val { width: 48px !important; }
.set-row.loaded .step { width: 34px; }
.strength-grid { display: grid; gap: 8px 24px; }
@media (min-width: 760px) { .strength-grid { grid-template-columns: repeat(3, 1fr); } }
.strength-grid h3 { margin: 8px 0 0; font-size: .95rem; }
.strength-grid h3 a { color: var(--text); }
.ex .coach-note { margin: 0 0 10px; }
.chip.ghost-chip { background: transparent; border-style: dashed; }

/* ---------- Sync ---------- */
.top-actions { align-items: center; }
.sync-dot { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sync-dot::before, .sync-state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.sync-dot[data-state="synced"]::before, .sync-state[data-state="synced"]::before { background: var(--ok); }
.sync-dot[data-state="syncing"]::before, .sync-state[data-state="syncing"]::before { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.sync-dot[data-state="error"]::before, .sync-state[data-state="error"]::before { background: var(--bad); }
.sync-dot[data-state="offline"]::before, .sync-dot[data-state="signed-out"]::before { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.sync-state { display: inline-flex; vertical-align: middle; margin-right: 4px; }
.sync-msg { color: var(--bad); }
input[type=email], input[type=password] {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-top: 6px;
}
@keyframes pulse { 50% { opacity: .35; } }
