/* Gym Manager — lagoon, husk, sun, coral */
:root {
  --ink: #17302C;
  --ink-2: #4B605C;
  --ink-3: #7A8C88;
  --line: #D6E2DE;
  --line-2: #E7EFEC;
  --bg: #EEF4F2;
  --surface: #FFFFFF;
  --lagoon: #0B6E66;
  --lagoon-2: #0E8F86;
  --lagoon-dark: #084F49;
  --lagoon-soft: #DCF0EB;
  --deep: #10332F;
  --sun: #F2B705;
  --sun-dark: #C99300;
  --sun-soft: #FFF4CC;
  --coral: #E5533D;
  --coral-dark: #B83A27;
  --coral-soft: #FCE4DF;
  --husk: #7B4B2A;
  --leaf: #3FA34D;
  --leaf-dark: #2B7E37;
  --leaf-soft: #E1F3E2;
  --radius: 10px;
  --radius-lg: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--lagoon); }
a:hover { color: var(--lagoon-dark); }
small, .small { font-size: .85em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .88rem; color: var(--ink); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 40px;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--lagoon); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lagoon-2); box-shadow: 0 0 0 3px var(--lagoon-soft); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: 1rem; margin-bottom: 6px; padding: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hint { font-weight: 500; color: var(--ink-3); font-size: .8rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 .9rem var(--font); padding: 9px 16px; min-height: 40px; border-radius: 8px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--lagoon); border-color: var(--lagoon); color: #fff; }
.btn-primary:hover { background: var(--lagoon-dark); border-color: var(--lagoon-dark); color: #fff; }
.btn-danger { color: var(--coral-dark); border-color: #F1C3BA; }
.btn-danger:hover { background: var(--coral-soft); border-color: var(--coral); color: var(--coral-dark); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .82rem; }
.btn-block { width: 100%; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--lagoon); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-weight: 600; border: 1.5px solid; }
.flash-ok { background: var(--leaf-soft); border-color: #B5DDB8; color: #1F5E2A; }
.flash-error { background: var(--coral-soft); border-color: #F1C3BA; color: var(--coral-dark); }
.flash-info { background: var(--sun-soft); border-color: #F0DC8A; color: #6B4F00; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--leaf-soft); color: #1F5E2A; }
.badge-warn { background: var(--sun-soft); color: #6B4F00; }
.badge-bad { background: var(--coral-soft); color: var(--coral-dark); }
.badge-lagoon { background: var(--lagoon-soft); color: var(--lagoon-dark); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- Panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.cols > .panel + .panel, .cols-even > .panel + .panel, .builder > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 14px 18px 0; }
table { border-collapse: collapse; width: 100%; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th { font-size: .78rem; font-weight: 700; color: var(--ink-2); background: #F7FAF9; border-bottom-color: var(--line); }
.table tbody tr:hover { background: #F7FBFA; }
.table td.right, .table th.right { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table a.rowlink { color: var(--ink); font-weight: 700; text-decoration: none; }
.table a.rowlink:hover { color: var(--lagoon); text-decoration: underline; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.table-wrap { overflow-x: auto; }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-2); }
.empty .kokko { display: block; margin: 0 auto 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--ink-2); font-weight: 600; font-size: .86rem; }
dl.facts dd { margin: 0; font-weight: 600; }

/* ---------- Plain (auth) layout ---------- */
body.plain { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--deep); }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 400px; }
.auth-hero { text-align: center; margin-bottom: 6px; }
.auth-title { font-size: 1.6rem; margin-bottom: 4px; }
.auth-foot { text-align: center; margin-top: 14px; font-size: .9rem; }

/* ---------- Desk layout (super admin, managers) ---------- */
.desk { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--deep) 236px, transparent 236px); }
.side { background: var(--deep); color: #CFE3DF; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; text-decoration: none; }
.side .brand .kokko { flex: none; }
.side .brand strong { font-family: var(--display); font-size: 1.05rem; line-height: 1.1; display: block; }
.side .brand span { font-size: .76rem; color: #8FB3AD; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #CFE3DF; text-decoration: none; font-weight: 600; font-size: .92rem; }
.side a.nav svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.nav.is-active { background: var(--lagoon); color: #fff; }
.side .nav-sep { margin: 14px 10px 6px; font-size: .74rem; color: #7FA39D; font-weight: 700; }
.side .side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.side .side-foot .who { color: #fff; font-weight: 700; }
.side .side-foot a, .side .side-foot button { color: #9FC4BE; font-size: .85rem; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 32px 6px; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.topbar .sub { color: var(--ink-2); margin-top: 2px; font-weight: 600; }
.content { padding: 14px 32px 40px; max-width: 1320px; }
.act-banner { background: var(--sun); color: #3D2C00; padding: 9px 32px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.act-banner button { background: #3D2C00; color: var(--sun); border: 0; border-radius: 6px; padding: 5px 12px; font-weight: 700; cursor: pointer; }
.expiry-banner { background: var(--coral-soft); color: var(--coral-dark); padding: 8px 32px; font-weight: 700; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* KPI row: one bordered strip, cells divided — not a card per number */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.kpi { padding: 14px 18px; border-right: 1px solid var(--line-2); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-family: var(--display); font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: .84rem; font-weight: 600; }
.kpi .d { font-size: .8rem; font-weight: 700; }
.up { color: var(--leaf-dark); } .down { color: var(--coral-dark); }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.is-active { color: var(--lagoon); border-bottom-color: var(--lagoon); }
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .84rem; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--lagoon-soft); color: var(--lagoon-dark); font-weight: 800; font-size: .8rem; flex: none; }
.person { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; padding: 6px 12px; border-radius: 99px; }
.status-open { background: var(--leaf-soft); color: #1F5E2A; }
.status-closed { background: var(--line-2); color: var(--ink-2); }
.status-peak { background: var(--sun-soft); color: #6B4F00; }
details.drawer { border: 1px dashed var(--line); border-radius: var(--radius); padding: 0 14px; background: #FBFDFC; }
details.drawer[open] { padding-bottom: 14px; }
details.drawer summary { cursor: pointer; font-weight: 700; padding: 11px 0; color: var(--lagoon); list-style: none; }
details.drawer summary::-webkit-details-marker { display: none; }
details.drawer summary::before { content: "+ "; }
details.drawer[open] summary::before { content: "− "; }
.log-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .82rem; }
.log-who { font-weight: 700; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

/* 24-hour strips (hours page, reports) */
.strip { position: relative; height: 16px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--line-2) 0 calc(100%/24 - 1px), #fff calc(100%/24 - 1px) calc(100%/24)); overflow: hidden; }
.strip span { position: absolute; top: 0; bottom: 0; }
.strip .strip-open { background: var(--lagoon-2); opacity: .85; }
.strip .strip-peak { background: var(--sun); top: 9px; }
.strip-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.week-grid { display: grid; grid-template-columns: 110px 1fr 190px; gap: 8px 14px; align-items: center; }
.week-grid .day { font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.chart-box { position: relative; height: 240px; }
.bars-h { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; font-size: .88rem; }
.bar-track { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--lagoon-2); border-radius: 99px; }

/* ---------- App layout (trainers, members — phone first) ---------- */
body.app-body { background: var(--bg); }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }
.app-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; gap: 10px; }
.app-top .gym { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.app-top .gym small { display: block; font-family: var(--font); color: var(--ink-2); font-weight: 600; font-size: .78rem; }
.app-content { padding: 8px 16px 16px; }
.app .panel { border-radius: var(--radius-lg); padding: 16px; }
.app h1 { font-size: 1.5rem; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabbar-in { max-width: 560px; margin: 0 auto; display: flex; justify-content: space-around; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 10px; min-width: 64px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.is-active { color: var(--lagoon); }
.hello { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px; background: var(--deep); color: #fff; border-radius: var(--radius-lg); padding: 16px 12px 0 18px; overflow: hidden; margin-bottom: 14px; }
.hello h1 { color: #fff; margin: 0 0 4px; }
.hello p { color: #A9CBC5; margin: 0 0 14px; font-weight: 600; }
.hello .kokko { margin-bottom: -18px; }
.streak { display: inline-flex; align-items: center; gap: 6px; background: var(--sun); color: #3D2C00; font-weight: 800; border-radius: 99px; padding: 4px 12px; margin-bottom: 14px; font-size: .9rem; }
.tile-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile .v { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.tile .l { font-size: .78rem; color: var(--ink-2); font-weight: 700; }
.routine { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.routine .r-main { flex: 1; min-width: 0; }
.routine .r-name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.routine .r-meta { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.routine .r-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--lagoon-soft); display: grid; place-items: center; flex: none; color: var(--lagoon-dark); font-weight: 800; font-family: var(--display); }
.routine .r-icon.mine { background: var(--sun-soft); color: #6B4F00; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 800; }
.list-item .li-sub { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.chev { color: var(--ink-3); font-size: 1.3rem; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 8px; }
.section-title h2 { margin: 0; font-size: 1.1rem; }
.heatmap { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heatmap span { aspect-ratio: 1; border-radius: 3px; background: var(--line-2); }
.heatmap span.on { background: var(--lagoon-2); }
.heatmap span.today { outline: 2px solid var(--sun); }

/* chunky game buttons */
.gbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; border-radius: 16px; border: 0; font: 800 1.05rem var(--font); letter-spacing: .02em; cursor: pointer; text-decoration: none; transition: transform .05s; }
.gbtn:active { transform: translateY(3px); }
.gbtn-go { background: var(--leaf); color: #fff; box-shadow: 0 5px 0 var(--leaf-dark); }
.gbtn-go:active { box-shadow: 0 2px 0 var(--leaf-dark); }
.gbtn-lagoon { background: var(--lagoon-2); color: #fff; box-shadow: 0 5px 0 var(--lagoon-dark); }
.gbtn-sun { background: var(--sun); color: #3D2C00; box-shadow: 0 5px 0 var(--sun-dark); }
.gbtn-soft { background: #fff; color: var(--ink-2); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.gbtn-sm { min-height: 42px; font-size: .92rem; border-radius: 12px; width: auto; padding: 0 18px; }
.gbtn:disabled { opacity: .5; cursor: default; }

/* ---------- Kokko the coconut ---------- */
.kokko .kk-arms, .kokko .kk-mouth, .kokko .kk-eyes-closed, .kokko .kk-sweat { display: none; }
.kokko[data-pose=idle] .kk-arms-idle, .kokko[data-pose=flex] .kk-arms-flex, .kokko[data-pose=cheer] .kk-arms-cheer, .kokko[data-pose=rest] .kk-arms-rest { display: inline; }
.kokko[data-mood=smile] .kk-mouth-smile, .kokko[data-mood=grin] .kk-mouth-grin, .kokko[data-mood=focus] .kk-mouth-focus, .kokko[data-mood=sleepy] .kk-mouth-smile { display: inline; }
.kokko[data-mood=sleepy] .kk-eyes-open { display: none; }
.kokko[data-mood=sleepy] .kk-eyes-closed { display: inline; }
.kokko[data-mood=focus] .kk-sweat, .kokko[data-pose=flex] .kk-sweat { display: inline; }
.kokko .kk-brows-happy { display: none; }
.kokko[data-mood=smile] .kk-brows-focus, .kokko[data-mood=sleepy] .kk-brows-focus, .kokko[data-mood=grin] .kk-brows-focus { display: none; }
.kokko[data-mood=smile] .kk-brows-happy, .kokko[data-mood=sleepy] .kk-brows-happy, .kokko[data-mood=grin] .kk-brows-happy { display: inline; }
.kokko-bounce { animation: kk-bounce .6s ease-out; transform-origin: 50% 100%; }
.kokko-breathe .kk-body-all { animation: kk-breathe 3s ease-in-out infinite; transform-origin: 100px 200px; }
@keyframes kk-bounce { 0% { transform: scale(1, 1); } 30% { transform: scale(1.08, .92); } 60% { transform: scale(.95, 1.06) translateY(-10px); } 100% { transform: scale(1, 1); } }
@keyframes kk-breathe { 50% { transform: scale(1.025, .985); } }

/* ---------- Muscle map ---------- */
.muscle-map { width: 100%; max-width: 260px; height: auto; }
.muscle-map .mm-body { fill: #E9F0EE; stroke: #C9D7D3; stroke-width: 1.2; }
.muscle-map .mm-idle { fill: #D3DFDB; }
.muscle-map .mm-primary { fill: var(--coral); }
.muscle-map .mm-secondary { fill: var(--sun); }
.muscle-map text { font: 700 9px var(--font); fill: var(--ink-3); }
.mm-legend { display: flex; gap: 12px; font-size: .78rem; font-weight: 700; color: var(--ink-2); justify-content: center; }
.mm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Exercise detail ---------- */
.ex-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-radius: 14px; overflow: hidden; background: #fff; }
.ex-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--line-2); }
.ex-anim { position: relative; border-radius: 16px; overflow: hidden; background: #fff; aspect-ratio: 4/3; border: 1px solid var(--line); }
.ex-anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ex-anim img + img { animation: ex-swap 2.4s steps(1) infinite; }
@keyframes ex-swap { 0% { opacity: 0; } 50% { opacity: 1; } }
ol.howto { padding-left: 1.2em; margin: 0; }
ol.howto li { margin-bottom: 6px; }

/* ---------- Routine builder ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.app .builder { grid-template-columns: 1fr; }
.rb-item { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.rb-item-head { display: flex; gap: 10px; align-items: center; }
.rb-item-head img { width: 52px; height: 40px; object-fit: cover; border-radius: 8px; background: var(--line-2); flex: none; }
.rb-item-head .t { flex: 1; min-width: 0; font-weight: 800; line-height: 1.2; }
.rb-item-head .t small { display: block; font-weight: 600; color: var(--ink-2); }
.rb-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 8px; margin-top: 10px; }
.rb-fields label { font-size: .74rem; }
.rb-fields input { min-height: 36px; padding: 6px 8px; }
.rb-move { display: flex; gap: 2px; }
.rb-move button { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; color: var(--ink-2); }
.ex-results { max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ex-result { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; font: inherit; width: 100%; }
.ex-result:hover { border-color: var(--lagoon-2); }
.ex-result img { width: 60px; height: 45px; object-fit: cover; border-radius: 8px; background: var(--line-2); flex: none; }
.ex-result .t { font-weight: 800; line-height: 1.2; }
.ex-result .t small { display: block; font-weight: 600; color: var(--ink-2); }
.ex-result .add { margin-left: auto; font-weight: 800; color: var(--lagoon); font-size: 1.4rem; padding: 0 6px; }
.warn-inline { background: var(--coral-soft); color: var(--coral-dark); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: .82rem; margin-top: 8px; }

/* ---------- Workout player ---------- */
body.player-body { background: #fff; }
.player { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.pl-top { display: flex; align-items: center; gap: 12px; }
.pl-close { width: 36px; height: 36px; border: 0; background: none; font-size: 1.6rem; color: var(--ink-3); cursor: pointer; line-height: 1; }
.pl-progress { flex: 1; height: 16px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.pl-progress span { display: block; height: 100%; background: var(--leaf); border-radius: 99px; transition: width .4s ease; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.pl-count { font-weight: 800; color: var(--ink-2); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pl-stage { flex: 1; display: flex; flex-direction: column; padding-top: 14px; }
.pl-kicker { font-weight: 800; color: var(--lagoon); font-size: .9rem; }
.pl-title { font-size: 1.6rem; margin: 2px 0 10px; }
.pl-coach { display: flex; align-items: flex-end; gap: 6px; margin: 10px 0; }
.pl-bubble { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 700; margin-bottom: 24px; }
.pl-bubble::before { content: ""; position: absolute; left: -9px; bottom: 14px; width: 14px; height: 14px; background: #fff; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.pl-target { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.pl-target .tile { text-align: center; }
.pl-target .tile .v { font-size: 1.6rem; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.stepper button { height: 52px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: 800 1.4rem var(--font); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.stepper button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.stepper input { text-align: center; font: 800 1.5rem var(--display); height: 52px; border-radius: 14px; border-width: 2px; }
.stepper-label { font-weight: 800; color: var(--ink-2); font-size: .85rem; margin: 10px 0 6px; display: flex; justify-content: space-between; }
.pl-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding-top: 14px; }
.pl-feedback { position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--leaf-soft); transform: translateY(100%); transition: transform .25s ease; z-index: 30; }
.pl-feedback.show { transform: translateY(0); }
.pl-feedback.skip { background: var(--line-2); }
.pl-feedback-in { max-width: 560px; margin: 0 auto; }
.pl-feedback h3 { color: var(--leaf-dark); font-size: 1.25rem; margin-bottom: 2px; }
.pl-feedback.skip h3 { color: var(--ink-2); }
.pl-feedback p { font-weight: 700; color: #1F5E2A; }
.pl-feedback.skip p { color: var(--ink-2); }
.rest-ring { width: 180px; height: 180px; margin: 10px auto; position: relative; }
.rest-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rest-ring .t { position: absolute; inset: 0; display: grid; place-items: center; font: 800 2.6rem var(--display); font-variant-numeric: tabular-nums; }
.pl-caution { background: var(--coral-soft); color: var(--coral-dark); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: .88rem; margin-bottom: 10px; }
.pl-tip { color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.sets-dots { display: flex; gap: 6px; }
.sets-dots i { width: 22px; height: 8px; border-radius: 99px; background: var(--line); }
.sets-dots i.done { background: var(--leaf); }
.sets-dots i.skipped { background: var(--ink-3); }
.sets-dots i.now { background: var(--sun); }
.done-hero { text-align: center; padding-top: 20px; }
.done-hero h1 { font-size: 2rem; color: var(--leaf-dark); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .cols, .cols-even, .builder { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .desk { grid-template-columns: 1fr; background: none; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .side .brand { width: 100%; padding-bottom: 6px; }
  .side .nav-sep { display: none; }
  .side .side-foot { width: 100%; margin-top: 6px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .week-grid { grid-template-columns: 90px 1fr; }
  .week-grid .wh { grid-column: 2; }
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
