/* Modo Músculo design system — see DESIGN_SYSTEM.md */
:root {
  --orange: #FF7A00;
  --orange-2: #FF9A3D;
  --blue: #00B4FF;
  --lime: #B4FF00;
  --purple: #A78BFA;
  --red: #FF4757;
  --white: #FFFFFF;
  --gray: #94A3B8;

  --font-display: "Bahnschrift", "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 14px;
  --nav-h: 68px;
  --side-w: 236px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .25);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html[data-theme="dark"] {
  --bg: #0F1622;
  --bg-2: #0B111B;
  --surface: #162131;
  --surface-2: #1C2A3E;
  --surface-3: #22334B;
  --border: #26364D;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --muted: #94A3B8;
  --body-fill: #3A4A61;
  --body-stroke: #5B6B82;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F4F6FA;
  --bg-2: #E9EDF4;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --surface-3: #E5EAF2;
  --border: #D8DFEA;
  --text: #0F1622;
  --text-2: #334155;
  --muted: #5B6B82;
  --body-fill: #CBD5E1;
  --body-stroke: #94A3B8;
  --lime: #5E9900;
  --blue: #0284C7;
  --orange: #E86A00;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: .01em; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .7em; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Boot splash (shown until WebAssembly starts) ---------- */
.boot-splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #0F1622; color: #fff; z-index: 1000; transition: opacity .35s; }
.boot-splash.hide { opacity: 0; pointer-events: none; }
.boot-title { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; font-style: italic; letter-spacing: .04em; }
.boot-title span, .brand span { color: #FF7A00; }
.boot-sub { color: #94A3B8; }
.boot-bar { width: 160px; height: 4px; background: #1C2A3E; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.boot-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #FF7A00, #B4FF00); animation: boot 1.1s infinite var(--ease); }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

.blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px; background: var(--red); color: #fff; z-index: 2000; }
.blazor-error-ui .reload { color: #fff; font-weight: 700; margin-left: 8px; }
.server-error { max-width: 560px; margin: 10vh auto; padding: 24px; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.15rem; letter-spacing: .04em; color: var(--text); text-decoration: none !important; }
.brand img { width: 30px; height: 30px; }
.topbar .spacer { flex: 1; }
.page { max-width: 1120px; margin: 0 auto; padding: 16px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-header p { margin: 0; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); display: inline-block; }
.status-dot.off { background: var(--gray); }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
.bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h); color: var(--muted); font-size: .72rem; background: none; border: 0; text-decoration: none !important; cursor: pointer; font-family: inherit; }
.bottom-nav a.active { color: var(--orange); }
.bottom-nav .train { position: relative; }
.bottom-nav .train span.fab { width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--orange-2), var(--orange)); color: #fff; box-shadow: 0 6px 18px rgba(255, 122, 0, .45); }

@media (min-width: 1024px) {
  .sidebar { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: 0 0 var(--side-w); padding: 18px 12px; background: var(--bg-2); border-right: 1px solid var(--border); overflow-y: auto; }
  .sidebar .brand { padding: 4px 10px 16px; font-size: 1.25rem; }
  .sidebar a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; text-decoration: none !important; }
  .sidebar a:hover { background: var(--surface); }
  .sidebar a.active { background: var(--surface-2); color: var(--orange); }
  .sidebar .side-cta { margin: 10px 4px; }
  .sidebar .side-foot { margin-top: auto; padding: 10px; font-size: .8rem; color: var(--muted); }
  .bottom-nav, .topbar .brand { display: none; }
  .main { padding-bottom: 24px; }
  .page { padding: 24px 28px; }
}

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.flat { background: var(--surface-2); }
.card + .card { margin-top: var(--gap); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title h2, .card-title h3 { margin: 0; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.grid { display: grid; gap: var(--gap); }
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } .grid-3 { gap: 8px; } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin: 22px 0 10px; }

/* ---------- Buttons and inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 .95rem var(--font-body); cursor: pointer; text-decoration: none !important; transition: transform .08s, background .2s, border-color .2s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--orange-2), var(--orange)); color: #fff; border: 0; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.btn.secondary { background: transparent; border-color: var(--blue); color: var(--blue); }
.btn.success { background: var(--lime); color: #0F1622; border: 0; font-weight: 800; }
.btn.danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.05rem; border-radius: 14px; }
.btn.xl { min-height: 72px; font-size: 1.25rem; border-radius: 18px; }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: .85rem; border-radius: 9px; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 34px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: .82rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: color-mix(in srgb, var(--orange) 18%, transparent); border-color: var(--orange); color: var(--text); }
.chip.static { cursor: default; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.tag.orange { background: color-mix(in srgb, var(--orange) 20%, transparent); color: var(--orange); }
.tag.blue { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.tag.lime { background: color-mix(in srgb, var(--lime) 18%, transparent); color: var(--lime); }
.tag.purple { background: color-mix(in srgb, var(--purple) 20%, transparent); color: var(--purple); }
.tag.red { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--text-2); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 500 1rem var(--font-body); }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--blue); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 26px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked { background: var(--lime); }
.switch input:checked::after { transform: translateX(20px); }
input[type=range] { width: 100%; accent-color: var(--orange); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; }
.scale button.on { background: var(--orange); border-color: var(--orange); color: #fff; }

/* ---------- Dashboard ---------- */
.hero { position: relative; overflow: hidden; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--orange) 14%, transparent), transparent 55%), var(--surface); }
.hero h1 { font-size: 1.55rem; margin-bottom: 4px; }
.hero .meta { color: var(--muted); font-size: .9rem; }
.hero .big-time { font-family: var(--font-display); font-weight: 800; color: var(--orange); font-size: 1.6rem; }
.hero-body { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.hero-body .mini-map { width: 120px; }
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.phase { text-align: center; padding: 10px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.phase b { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.phase.warm b { color: var(--blue); } .phase.work b { color: var(--orange); } .phase.cool b { color: var(--lime); }
.phase small { font-size: .78rem; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.module { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; min-height: 84px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .8rem; font-weight: 600; text-align: center; text-decoration: none !important; transition: border-color .2s, transform .1s; }
.module:hover { border-color: var(--orange); transform: translateY(-1px); }
.module svg { width: 24px; height: 24px; }
.motto { text-align: center; font-style: italic; font-weight: 600; color: var(--lime); padding: 14px 0 6px; border-top: 1px solid var(--border); margin-top: 18px; }
.stat { padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.stat .value { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; line-height: 1.1; }
.stat .label { font-size: .78rem; color: var(--muted); }
.week-dots { display: flex; gap: 6px; }
.week-dots span { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); }
.week-dots i { display: block; height: 26px; border-radius: 8px; margin-bottom: 4px; background: var(--surface-3); border: 1px solid var(--border); }
.week-dots i.done { background: var(--lime); border-color: var(--lime); }
.week-dots i.today { border: 2px solid var(--orange); }
.week-dots i.rest { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface-3) 4px, var(--surface-3) 8px); }
.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), color-mix(in srgb, var(--lime) 70%, var(--blue))); border-radius: 8px; transition: width .4s var(--ease); }
.progress.orange > span { background: linear-gradient(90deg, var(--orange-2), var(--orange)); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--blue) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); font-size: .9rem; }
.notice.warn { background: color-mix(in srgb, var(--red) 9%, var(--surface)); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.notice.ok { background: color-mix(in srgb, var(--lime) 9%, var(--surface)); border-color: color-mix(in srgb, var(--lime) 40%, transparent); }
.notice svg { flex: none; margin-top: 2px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: .82rem; color: var(--muted); }
.thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--surface-2); flex: none; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg.body-map { width: 46px; height: 46px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.ex-card { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none !important; transition: border-color .2s, transform .1s; }
.ex-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.ex-card .media { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.ex-card .media img { width: 100%; height: 100%; object-fit: cover; }
.ex-card .media svg.body-map { height: 92%; width: auto; }
.ex-card .body { padding: 10px 12px; }
.ex-card .name { font-weight: 700; font-size: .9rem; line-height: 1.25; }
.ex-card .sub { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.pending-badge { position: absolute; left: 8px; bottom: 8px; font-size: .64rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(15, 22, 34, .8); color: #CBD5E1; }

/* ---------- Week planner ---------- */
.week { display: grid; gap: 10px; }
.day-card { display: flex; flex-direction: column; }
.day-card .dname { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; color: var(--muted); font-size: .85rem; }
.day-card .title { font-weight: 700; }
.day-card .sub { font-size: .8rem; color: var(--muted); }

/* ---------- Body map ---------- */
svg.body-map .m { fill: var(--body-fill); stroke: var(--body-stroke); stroke-width: .6; transition: fill .2s; }
svg.body-map .silhouette { fill: color-mix(in srgb, var(--body-fill) 55%, var(--bg)); stroke: var(--body-stroke); stroke-width: .8; }
svg.body-map .m.primary { fill: var(--orange); }
svg.body-map .m.secondary { fill: color-mix(in srgb, var(--orange) 45%, var(--body-fill)); }
svg.body-map .m.selected { fill: var(--red); stroke: #fff; stroke-width: 1.2; }
svg.body-map.interactive .m { cursor: pointer; }
svg.body-map.interactive .m:hover { stroke: var(--text); stroke-width: 1.2; }
svg.body-map .m.load-1 { fill: #3B82F6; } svg.body-map .m.load-2 { fill: #22C55E; } svg.body-map .m.load-3 { fill: #F59E0B; } svg.body-map .m.load-4 { fill: #EF4444; }
svg.body-map .view-label { fill: var(--muted); font: 700 9px var(--font-body); text-anchor: middle; letter-spacing: .1em; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.legend i.load-1 { background: #3B82F6; } .legend i.load-2 { background: #22C55E; } .legend i.load-3 { background: #F59E0B; } .legend i.load-4 { background: #EF4444; }

/* ---------- Player ---------- */
.player { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.player-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); border-bottom: 1px solid var(--border); }
.player-top .elapsed { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.player-body { flex: 1; display: grid; gap: 14px; padding: 14px; max-width: 1180px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) { .player-body { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.player-visual { position: relative; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); aspect-ratio: 4 / 3; display: grid; place-items: center; }
.player-visual img { width: 100%; height: 100%; object-fit: cover; }
.player-visual .visual-map { height: 92%; display: flex; gap: 6px; }
.player-visual .block-tag { position: absolute; top: 10px; left: 10px; }
.player-name { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1.1; margin: 0; }
.set-counter { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--orange); }
.timer { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 4.2rem; line-height: 1; text-align: center; }
.timer.rest { color: var(--blue); }
.timer.final { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.ring-wrap { display: grid; place-items: center; position: relative; }
.ring-wrap .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 8px; }
.stepper button { height: 52px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.stepper .val { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stepper .val small { display: block; font-size: .72rem; font-family: var(--font-body); font-weight: 600; }
.stepper input { width: 100%; text-align: center; background: transparent; border: 0; color: var(--text); font: 800 1.7rem var(--font-display); }
.set-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.set-pill { min-width: 54px; padding: 6px 8px; border-radius: 10px; text-align: center; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); }
.set-pill.done { background: color-mix(in srgb, var(--lime) 15%, var(--surface)); border-color: var(--lime); }
.set-pill.current { border: 2px solid var(--orange); }
.player-actions { position: sticky; bottom: 0; display: grid; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.player-actions .tools { display: flex; justify-content: space-between; gap: 6px; }
.player-actions .tools .btn { flex: 1; flex-direction: column; gap: 2px; font-size: .7rem; min-height: 54px; padding: 4px; }
.next-up { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); }
.rir-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rir-row button { min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; font-size: .8rem; }
.rir-row button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.paused-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 12, 20, .78); backdrop-filter: blur(4px); color: #fff; text-align: center; padding: 20px; }

/* ---------- Sheet / modal ---------- */
.backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(5, 8, 14, .6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .25s var(--ease); }
@media (min-width: 760px) { .backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: calc(100vw - 32px); animation: up .25s var(--ease); }
.toast.achievement { border-color: var(--lime); }
@media (min-width: 1024px) { .toast { bottom: 24px; } }

/* ---------- Charts / calendar ---------- */
svg.chart { width: 100%; height: auto; overflow: visible; }
svg.chart .grid-line { stroke: var(--border); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
svg.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dot { stroke: var(--surface); stroke-width: 2; }
svg.chart .bar { rx: 4; }
svg.chart .val { fill: var(--text-2); font-size: 10px; font-weight: 700; text-anchor: middle; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { opacity: .6; margin-bottom: 8px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 700; }
.cal .day { aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .85rem; position: relative; }
.cal .day.out { opacity: .3; }
.cal .day.today { border: 2px solid var(--orange); }
.cal .day.l1 { background: color-mix(in srgb, var(--lime) 25%, var(--surface)); }
.cal .day.l2 { background: color-mix(in srgb, var(--lime) 50%, var(--surface)); }
.cal .day.l3 { background: color-mix(in srgb, var(--lime) 80%, var(--surface)); color: #0F1622; font-weight: 700; }
.cal .day.planned::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
.cal .day.restday::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--purple); }

/* ---------- Achievements ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.badge .medal { width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.badge.on .medal { background: radial-gradient(circle at 30% 30%, var(--lime), color-mix(in srgb, var(--lime) 40%, var(--orange))); color: #0F1622; box-shadow: 0 0 0 4px color-mix(in srgb, var(--lime) 25%, transparent); }
.badge.off { opacity: .55; }
.badge .bname { font-weight: 700; font-size: .88rem; }
.badge small { display: block; margin-top: 4px; font-size: .74rem; }

/* ---------- Coach ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--orange) 20%, var(--surface)); border: 1px solid color-mix(in srgb, var(--orange) 45%, transparent); }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg .src { display: block; margin-top: 6px; font-size: .7rem; color: var(--muted); }
.chat-input { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 10px 0; background: var(--bg); }
@media (min-width: 1024px) { .chat-input { bottom: 0; } }

/* ---------- Misc ---------- */
.ol-steps { padding-left: 1.2em; margin: 0; }
.ol-steps li { margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); }
.hide-mobile { display: none; }
@media (min-width: 760px) { .hide-mobile { display: initial; } .hide-desktop { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
