/* Eagle Lift web app. Colours and type come from tokens.css (copied from site/styles.css; keep them equal).
   Rules use tokens only. Orange (--accent/--link) only for things you tap (docs/UI_STYLE.md). */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-small); line-height: var(--lh);
  background: var(--bg); color: var(--text); min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.2; }
h1 { font-size: 28px; letter-spacing: -.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.num, td, .stat b { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-caption); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: var(--on-navy); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-navy); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }
.tabs { display: none; gap: 4px; flex: 1; }
@media (min-width: 900px) { .tabs { display: flex; } }
.tabs a { color: var(--on-navy-2); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.tabs a:hover { color: var(--on-navy); text-decoration: none; background: rgba(255, 255, 255, .06); }
.tabs a[aria-current="page"] { color: var(--on-navy); background: rgba(255, 255, 255, .12); }
.top :focus-visible { outline-color: var(--focus-on-navy); }
.me { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); color: var(--on-navy);
  display: grid; place-items: center; font-weight: 700; border: 1px solid rgba(255, 255, 255, .2); }
.me:hover { text-decoration: none; }
.me[aria-current="page"] { border-color: var(--link-on-navy); }
.banner { background: var(--tint-bg); color: var(--tint-fg); font-size: var(--fs-caption); }
.banner a { color: var(--tint-fg); font-weight: 700; text-decoration: underline; }
.banner :focus-visible { outline-color: var(--focus); }  /* the banner is light, not navy like the rest of .top */
.banner > div { max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Bottom tab bar (phone width) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar a { text-align: center; padding: 14px 2px; font-size: 12px; font-weight: 600; color: var(--text-2); min-height: var(--tap); }
.tabbar a[aria-current="page"] { color: var(--link); }
.tabbar a:hover { text-decoration: none; }
@media (min-width: 900px) { .tabbar { display: none !important; } }

/* Page */
main { max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter) 48px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 12px; margin-bottom: 12px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text); min-height: var(--tap); }
a.row:hover { background: var(--tint-bg); text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--text-2); font-size: var(--fs-caption); }
.chev::after { content: "›"; color: var(--text-2); font-size: 20px; line-height: 1; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; margin: 24px 0 8px; }

/* Stats */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { color: var(--text-2); font-size: var(--fs-caption); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.r, th.r { text-align: right; }
tr.warm td { color: var(--text-2); }

/* Chips, pills, buttons, fields */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--tint-bg); color: var(--tint-fg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--on-accent); }
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: var(--card); color: var(--link); border-color: var(--line); }
.btn.secondary:hover { background: var(--tint-bg); }
.btn.danger { background: var(--card); color: var(--danger); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: var(--fs-caption); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; font-weight: 600; }
input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
label.field { display: grid; gap: 4px; font-weight: 600; font-size: var(--fs-caption); }

/* States */
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.loading { padding: 40px 0; text-align: center; color: var(--text-2); }
.error { padding: 12px 16px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-md); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 20px; max-width: min(92vw, 440px); }
dialog::backdrop { background: rgba(10, 18, 30, .5); }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* Charts (inline SVG drawn by js/chart.js) */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--text-2); font-size: 11px; }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--chart-1); }
.chart .dot.pr { fill: var(--chart-2); }
.chart .bar { fill: var(--chart-1); }
.chart .bar.dim { fill: var(--chart-3); }
.chart .bar:focus-visible, .chart .dot:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3px; }
.chart .goal { stroke: var(--chart-2); stroke-dasharray: 4 4; stroke-width: 1.5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-caption); color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: var(--fs-caption); }
.cal .dow { color: var(--text-2); font-weight: 600; padding: 4px 0; }
.cal .d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: var(--text); max-width: 100%; }
.cal .d.out { color: var(--text-2); opacity: .45; }
.cal .d.on { background: var(--navy-2); color: var(--on-navy); font-weight: 700; }
.cal a.d.on:hover { background: var(--accent); text-decoration: none; }
.cal .d.today { box-shadow: inset 0 0 0 2px var(--link); }

/* Sign in */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px var(--gutter); background: linear-gradient(160deg, var(--navy), var(--navy-2)); color: var(--on-navy); }
.signin .box { max-width: 420px; width: 100%; display: grid; gap: 18px; text-align: center; }
.signin .box img { margin: 0 auto; border-radius: 22px; }
.signin p { color: var(--on-navy-2); }
.signin a { color: var(--link-on-navy); }
.apple-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 12px;
  background: #ffffff; color: #000000; font: inherit; font-weight: 700; border: 0; cursor: pointer; width: 100%; }
.signin .btn.secondary { width: 100%; }
.apple-btn[disabled] { opacity: .6; cursor: not-allowed; }
.apple-btn[hidden] { display: none; }
/* Continue with Google: GIS draws its own button in an iframe; the box only centres it and keeps its height steady. */
.google-btn { display: flex; justify-content: center; min-height: 44px; margin-top: 10px; }
.google-btn[hidden] { display: none; }
.signin .small { font-size: var(--fs-caption); }
.signin-note { background: rgba(255, 255, 255, .1); color: var(--on-navy); border-radius: 10px; padding: 10px 12px; }
.signin-err { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; text-align: left; }
.signin-err[hidden] { display: none; }
.dev-form { display: grid; gap: 6px; text-align: left; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 16px; }
.dev-form label.field { color: var(--on-navy-2); }
.dev-row { display: flex; gap: 8px; }
.dev-row input { flex: 1; min-width: 0; width: 0; }
.signin .dev-row .btn.secondary { width: auto; }
.email-block { display: grid; gap: 10px; text-align: left; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 16px; }
.email-form { display: grid; gap: 6px; }
.email-form label.field { color: var(--on-navy-2); }
.email-form .btn { margin-top: 8px; width: 100%; }
.email-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--link-on-navy); font: inherit; font-size: var(--fs-caption); cursor: pointer; text-decoration: underline; }
.signin :focus-visible { outline-color: var(--focus-on-navy); }
.danger-zone { border-color: var(--danger); }

/* === History (W2) === */
.hist-search { margin-bottom: 8px; }
.hist-search input { width: 100%; }
.hist .section-label { margin-top: 16px; }
.hist-row .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; white-space: normal; }
.hist-pr { background: var(--tint-bg); color: var(--tint-fg); }
.hist-light { background: var(--card); color: var(--text-2); border: 1px solid var(--line); }
.hist-cardio .hist-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chart-2); flex: none; }
.hist-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { main > .hist-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
main > .hist-stats { margin-bottom: 16px; }
.hist-from { margin: -8px 0 16px; color: var(--text-2); }
.hist-note, .hist-prs { margin-bottom: 16px; }
.hist-prs ul { margin: 0; padding-left: 20px; }
.hist-exnote { margin-bottom: 8px; }
tr.hist-out td { color: var(--text-2); opacity: .6; }
.hist-ex .card-head h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-ex abbr { text-decoration: none; }
@media (max-width: 899px) { .hist aside { order: -1; } }
.hist .cal { max-width: 340px; margin: 0 auto; }

/* === Programs + Body (W4) === */
.pg-bars { display: grid; gap: 6px; }
.pg-bar { display: grid; grid-template-columns: 96px 1fr 36px; align-items: center; gap: 8px; font-size: var(--fs-caption); }
.pg-bar-t { height: 10px; background: var(--tint-bg); border-radius: 5px; overflow: hidden; }
.pg-bar-f { display: block; height: 100%; background: var(--chart-1); border-radius: 5px; }
.pg-bar-v { text-align: right; color: var(--text-2); }
.pg-meta { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-bottom: 20px; }
.pg-meta input { width: 100%; }
.pg-sum { position: sticky; top: 72px; }
.pg-mini { grid-template-columns: 1fr 1fr; }
.pg-sets td { padding: 4px; }
.pg-sets input, .pg-sets select { width: 100%; min-width: 56px; }
.pg-sets select { min-width: 104px; }
.pg-find { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pg-find input { flex: 1 1 200px; }
.pg-results { max-height: 320px; overflow-y: auto; }
/* Long (German) names wrap instead of running under the Add pill. */
.pg-pick .title { display: block; white-space: normal; overflow-wrap: anywhere; }
.pg-pick .pill { flex: none; }
button.row { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
button.row:hover { background: var(--tint-bg); }
.pg-actions { display: grid; gap: 10px; }
.card textarea { width: 100%; resize: vertical; }
.pg-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pg-add .error { flex-basis: 100%; }
.pg-add .error[hidden] { display: none; }
.pg-entries { margin-top: 16px; }
.pg-entries summary { cursor: pointer; font-weight: 600; color: var(--link); margin-bottom: 8px; }
input[type="date"] { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
@media (max-width: 899px) { .pg-sum { position: static; } }

/* === Insights + Exercises (W3) === */
.ins-tiles { margin-bottom: 16px; }
.ins-grid .card h2 { margin-bottom: 0; }
.ins-grid .card > h2 { margin-bottom: 12px; }
.ins-split { display: grid; gap: 12px; }
.ins-band-l { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-caption); margin-bottom: 4px; }
.ins-meter { height: 10px; border-radius: 999px; background: var(--tint-bg); overflow: hidden; }
.ins-meter i { display: block; height: 100%; background: var(--chart-1); border-radius: 999px; }
.ins-list { border: 0; border-radius: 0; }
.ins-list .row { padding-left: 0; padding-right: 0; }
.str-overall { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0 4px; }
.str-row { padding: 10px 0; }
.str-foot { margin-top: 12px; }
.hist-cnote { margin-top: 12px; }
.ex-search { width: 100%; margin-bottom: 12px; }
.ex-chips { margin-bottom: 16px; }
.ex-best { display: grid; text-align: right; }
.howto-box:not(:empty) { margin: 16px 0; }
.howto .howto-h { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 14px 0 6px; }
.howto ul, .howto ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.lib-count { margin-bottom: 8px; }
.ex-recs { margin: 16px 0 0; }

/* Free window note (older history kept, Pro shows it) */
.note.kept { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0; color: var(--text-2); font-size: 0.92em; }
.pro-tag { display: inline-block; font-size: 0.78em; font-weight: 600; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.edit-sets { table-layout: fixed; width: 100%; }
.edit-sets th:first-child, .edit-sets td:first-child { width: 36px; }
.edit-sets th:last-child, .edit-sets td:last-child { width: 40px; text-align: right; }
.edit-sets .linkbtn { font-size: 1.1rem; padding: 6px; }
.edit-sets td, .edit-sets th { padding-left: 4px; padding-right: 4px; }
.edit-sets input { width: 100%; min-width: 0; padding-left: 6px; padding-right: 6px; }
.edit-sets th:nth-child(2), .edit-sets td:nth-child(2) { width: 34%; }
.edit-sets td { vertical-align: middle; }
.equip { border: 0; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px 16px; }
.equip legend { margin-bottom: 6px; }
label.check { display: flex; gap: 8px; align-items: center; min-height: 32px; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent, currentColor); }
.note.ok { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0 0; }
.pl-rows { list-style: none; margin: 0; padding: 0; }
.pl-rows li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.pl-rows li:first-child { border-top: 0; }
.pl-how { margin-top: 10px; }
.pl-how summary { cursor: pointer; font-weight: 600; color: var(--link); }
.pl-how p { margin-top: 8px; }
.pl-use { display: grid; gap: 8px; margin-top: 16px; }
.cx-form { display: grid; gap: 14px; max-width: 520px; }
.cx-form input, .cx-form select { width: 100%; }
.cx-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.warn { color: var(--danger); }
.cx-head { margin: 24px 0 8px; align-items: center; }
.cx-head .section-label { margin: 0; }
.cx-card { margin-bottom: 16px; }
.wrap-titles .row .title { white-space: normal; }
.pl-rows .grow { flex: 1; min-width: 0; }
.pl-rows .num { white-space: nowrap; }
.pl-intro { margin-bottom: 16px; }

/* Your week (programs.js): weekday column, readable at 320 px */
.week { margin-bottom: 20px; }
.week h2 { font-size: var(--fs-title, 1.25rem); margin: 0; }
.week-days .row { padding: 10px 12px; gap: 10px; }
.week-wd { flex: 0 0 auto; min-width: 2.6em; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.week-days .row .title { white-space: normal; }

/* Reduce motion: nothing animates today; this keeps it that way for anyone who asks the system for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Keep N workouts: saved workouts outside the active set are greyed out (viewable, not editable) */
.row.inactive { opacity: .55; }
.pill.off { background: var(--card); color: var(--text-2); border: 1px solid var(--line); }
.keep-off { margin: 12px 0; }
dialog.keep { max-width: min(92vw, 560px); width: 100%; }
dialog.keep .keep-q { width: 100%; margin: 12px 0 8px; }
dialog.keep .keep-list { max-height: 50vh; overflow-y: auto; }
.keep-row { cursor: pointer; }
.keep-row input { width: 20px; height: 20px; flex: none; }
.early { margin-top: 6px; }
/* Eagle Lift Pro (#/pro): plan cards, Yearly highlighted, Free vs Pro table */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 16px 16px; }
.plan > h2 { margin: 0; }
.plan .btn { margin-top: auto; }
.plan .small { flex: 1 0 auto; margin-bottom: 12px; }
.plan.best { border: 2px solid var(--accent); padding: 19px 15px 15px; }
.plan .best-pill { position: absolute; top: -11px; left: 14px; background: var(--accent); color: var(--on-accent); }
.price { font-size: 26px; font-weight: 700; line-height: 1.2; }
.compare { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.compare th, .compare td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare thead th { border-top: 0; color: var(--text-2); font-weight: 600; }
.compare td { width: 30%; }
