:root {
  --bg: #0b0d10; --card: #14171c; --card2: #1a1e24; --line: #252a32;
  --text: #eceef1; --muted: #8b929c; --fire: #ff5a1f; --amber: #ffb020;
  --green: #3ddc84; --red: #ff4d4f; --blue: #4da3ff;
  --r: 16px; --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body.has-nav { padding-bottom: calc(76px + var(--safe-b)); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code { background: var(--card2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: .02em; margin: 0; line-height: 1.05; }
h1 { font-size: 34px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: .6em 0; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .right { text-align: right; }
.good { color: var(--green) !important; } .bad { color: var(--red) !important; }
.hidden { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 460px; margin: 0 auto; }
.login { padding-top: 10vh; }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }

/* top + bottom bars */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: rgba(11,13,16,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--head); font-size: 20px; text-transform: uppercase; letter-spacing: .03em; }
.brand .ic { color: var(--fire); width: 22px; height: 22px; }
.brand b { color: var(--fire); }
.toplinks { display: flex; gap: 4px; }
.toplinks a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 500; }
.toplinks a.on, .toplinks a:hover { color: var(--text); background: var(--card); }
@media (max-width: 480px) { .toplinks span { display: none; } }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-b)); background: rgba(14,16,20,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.bottomnav a.on { color: var(--fire); }
.bottomnav .ic { width: 23px; height: 23px; }

/* hero */
.hero { padding: 10px 2px 18px; }
.hero-title { font-size: 56px; font-weight: 800; line-height: .95; }
.hero-title span { color: var(--fire); }
.hero-title small { font-size: 28px; color: var(--muted); margin-left: 4px; }
.phase-line { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.hot { background: var(--fire); border-color: var(--fire); color: #fff; }
.bar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--fire), var(--amber)); border-radius: inherit; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; }
.card h2 + p { margin-top: 8px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.empty { text-align: center; padding: 30px 18px; }
.link { color: var(--fire); font-weight: 600; font-size: 14px; white-space: nowrap; }
.note { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--fire); background: var(--card2); border-radius: 0 10px 10px 0; font-size: 14px; color: #cfd3d8; }
.quote { text-align: center; font-family: var(--head); text-transform: uppercase; font-size: 20px; color: var(--muted); margin: 24px 0 10px; letter-spacing: .03em; }

.session { position: relative; overflow: hidden; }
.session::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--fire); }
.session.type-cardio::before { background: var(--blue); }
.session.type-recovery::before, .session.type-rest::before { background: var(--green); }
.drill { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.drill li { padding: 10px 12px; background: var(--card2); border-radius: 10px; font-weight: 500; }
.done-btn { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: transparent; color: var(--text); font: 600 14px Inter, sans-serif; cursor: pointer; }
.done-btn.is-done { background: var(--green); border-color: var(--green); color: #06210f; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash-ok { background: rgba(61,220,132,.1); border-color: rgba(61,220,132,.35); color: #9ff0c2; }
.flash-err { background: rgba(255,77,79,.1); border-color: rgba(255,77,79,.4); color: #ffb3b4; }
.flash-warn { background: rgba(255,176,32,.08); border-color: rgba(255,176,32,.35); color: #ffd58a; }
.warn-text { color: var(--amber); }
.callout { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--r);
  background: linear-gradient(135deg, rgba(255,90,31,.18), rgba(255,176,32,.08)); border: 1px solid rgba(255,90,31,.4); }
.callout > .ic:first-child { color: var(--fire); width: 26px; height: 26px; }
.callout div { flex: 1; display: flex; flex-direction: column; }
.callout span { color: var(--muted); font-size: 13px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.stat b { font-family: var(--head); font-size: 32px; line-height: 1.1; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checks li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.checks li.ok i { background: var(--green); border-color: var(--green); color: #06210f; }
.checks i .ic { width: 14px; height: 14px; stroke-width: 3; }
.checks span { color: var(--muted); font-size: 13px; text-align: right; }

.chart-box { position: relative; height: 280px; } .chart-box.sm { height: 190px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair figure, .thumbs figure { margin: 0; }
.pair img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; background: var(--card2); }
.pair figcaption { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px; border: 0;
  background: var(--fire); color: #fff; font: 700 15px Inter, sans-serif; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); } .btn:disabled { opacity: .6; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-full { width: 100%; }
.btn-ghost { background: var(--card2); border: 1px solid var(--line); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; font: inherit; display: inline-flex; }
.linkbtn:hover { color: var(--red); } .linkbtn.danger { color: var(--red); font-size: 13px; margin-top: 10px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.iconbtn.disabled { opacity: .3; }

/* forms */
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.form h2 { margin: 6px 0 12px; }
input, select, textarea { width: 100%; padding: 12px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: 500 16px Inter, sans-serif; outline: none; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { border-color: var(--fire); box-shadow: 0 0 0 3px rgba(255,90,31,.15); }
input[type=date] { color-scheme: dark; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.measure-grid small { font-size: 12px; font-weight: 600; color: var(--muted); }
.date-sm { width: auto; padding: 8px 10px; font-size: 14px; }

.daynav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.daypick { flex: 1; position: relative; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.daypick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.daypick div { display: flex; flex-direction: column; pointer-events: none; }
.daypick b { font-family: var(--head); text-transform: uppercase; font-size: 18px; }
.daypick span { font-size: 12px; color: var(--muted); }

.weight-input { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 6px 0 2px; }
.weight-input input { width: 190px; text-align: center; font: 800 56px var(--head); border: 0; border-bottom: 2px solid var(--line); border-radius: 0; background: transparent; padding: 0 4px; }
.weight-input input:focus { box-shadow: none; border-color: var(--fire); }
.weight-input span { font: 700 22px var(--head); color: var(--muted); }

.toggle-row { flex-direction: row !important; align-items: center; justify-content: space-between; margin: 0 !important; cursor: pointer; }
.toggle-row b { color: var(--text); font-size: 16px; font-family: var(--head); text-transform: uppercase; }
.toggle-row input { display: none; }
.switch { width: 54px; height: 32px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle-row input:checked + .switch { background: var(--green); }
.toggle-row input:checked + .switch::after { left: 26px; }

.stepper { display: flex; align-items: stretch; }
.stepper input { text-align: center; border-radius: 0; min-width: 0; }
.stepper button { width: 44px; flex: none; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 20px; cursor: pointer; }
.stepper button:first-child { border-radius: 11px 0 0 11px; border-right: 0; }
.stepper button:last-child { border-radius: 0 11px 11px 0; border-left: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0 !important; cursor: pointer; }
.chip input { display: none; }
.chip span { display: block; padding: 9px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-weight: 500; font-size: 13.5px; }
.chip input:checked + span { background: rgba(61,220,132,.14); border-color: var(--green); color: #b6f5d1; }
.chip-link { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.chip-link.on { background: var(--fire); border-color: var(--fire); color: #fff; }
.filter { margin-bottom: 14px; }

.filebtn { flex-direction: row !important; align-items: center; justify-content: center; gap: 8px !important; align-self: end; height: 47px; margin-top: 19px;
  border: 1.5px dashed var(--fire); border-radius: 11px; color: var(--fire) !important; cursor: pointer; position: relative; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; }
.previews img { width: 80px; height: 106px; object-fit: cover; border-radius: 10px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.thumbs img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; background: var(--card2); }
.thumbs figcaption { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.thumbs figcaption form { margin: 0; }
.thumbs .ic { width: 16px; height: 16px; }

.pose-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot { position: relative; aspect-ratio: 3/4; border-radius: 14px; border: 1.5px dashed var(--line); overflow: hidden; display: grid; place-items: center; cursor: pointer; margin: 0 !important; background: var(--bg); }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.has { border-style: solid; }
.slot.pending { border-color: var(--fire); }
.slot-empty .ic { width: 30px; height: 30px; color: var(--muted); }
.slot b { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 8px; text-align: center; color: #fff; font-family: var(--head); text-transform: uppercase; font-size: 15px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); }

.sticky-save { position: sticky; bottom: calc(76px + var(--safe-b)); z-index: 10; padding: 8px 0 4px; background: linear-gradient(transparent, var(--bg) 40%); margin-bottom: 14px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.tbl tr.cur td { background: rgba(255,90,31,.08); }
.tbl a { color: var(--fire); font-weight: 600; }

.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg a { padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg a.on { background: var(--fire); color: #fff; }
.seg.sm a { padding: 5px 10px; font-size: 12px; }

/* before/after */
.ba { position: relative; aspect-ratio: 3/4; max-height: 75vh; margin: 0 auto; overflow: hidden; border-radius: 14px; background: #000; user-select: none; }
.ba img { position: absolute; top: 0; left: 0; height: 100%; object-fit: cover; }
.ba-after { width: 100%; }
.ba-before-wrap { position: absolute; inset: 0 auto 0 0; overflow: hidden; width: 50%; }
.ba-before { width: auto; max-width: none; }
.ba-handle { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; transform: translateX(-50%); pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.ba-handle::after { content: '‹ ›'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; font-weight: 800; }
.ba-tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 8px; background: rgba(0,0,0,.6); font-size: 12px; font-weight: 700; }
.ba-tag.l { left: 10px; } .ba-tag.r { right: 10px; }
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; padding: 0; }

.gal-day { margin-bottom: 20px; }
.gal-day h3 { margin-bottom: 8px; font-size: 16px; }
.pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pager a { padding: 6px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }
.pager a.on { background: var(--fire); border-color: var(--fire); }

/* plan */
.motto-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.motto-row div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.motto-row span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.motto-row b { font-family: var(--head); text-transform: uppercase; font-size: 15px; }
.motto-row .on { border-color: var(--fire); background: rgba(255,90,31,.12); }
.motto-row .on b { color: var(--fire); }
.phase.current { border-color: rgba(255,90,31,.55); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 12px 0 4px; }
@media (max-width: 620px) { .week-grid { grid-template-columns: 1fr; } .wd { flex-direction: row !important; gap: 10px; align-items: center; } .wd span { width: 36px; } }
.wd { background: var(--card2); border-radius: 10px; padding: 9px; display: flex; flex-direction: column; gap: 3px; border-top: 3px solid var(--fire); }
.wd.type-cardio { border-top-color: var(--blue); } .wd.type-recovery, .wd.type-rest { border-top-color: var(--green); }
@media (max-width: 620px) { .wd { border-top: 0; border-left: 3px solid var(--fire); } .wd.type-cardio { border-left-color: var(--blue); } .wd.type-recovery, .wd.type-rest { border-left-color: var(--green); } }
.wd span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.wd b { font-size: 13px; font-weight: 600; line-height: 1.25; }
.wd.today { outline: 2px solid var(--fire); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 10px 0; }
.kv div { background: var(--card2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.kv span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.kv b { font-size: 14px; }
.meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; }
.meals h3 { color: var(--fire); margin-bottom: 4px; }
.meals ul { margin: 0; padding-left: 18px; font-size: 14px; color: #cfd3d8; }
.meals li { margin: 3px 0; }
