:root {
  --bg: #121212;
  --bg-2: #1a1a1a;
  --bg-3: #222;
  --bg-4: #2a2a2a;
  --bg-5: #333;
  --line: #3a3a3a;
  --text: #f3f3f3;
  --muted: #a3a3a3;
  --dim: #7a7a7a;
  --red: #d0122d;
  --red-2: #b10e24;
  --blue: #2f6fed;
  --green: #1fa85a;
  --light: #f3f4f6;
  --card: #fff;
  --shadow: 0 16px 50px rgba(0,0,0,.45);
  --rail: 46px;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
#app { min-height: 100%; display: flex; flex-direction: column; }
#app.fit { height: 100%; }
#app.light { background: var(--light); color: #1a1a1a; min-height: 100vh; }
#app.light .stage { background: var(--light); }

.topnav {
  height: 48px; background: #0e0e0e; display: flex; align-items: center;
  padding: 0 10px 0 14px; gap: 6px; border-bottom: 1px solid #000; flex-shrink: 0;
  position: sticky; top: 0; z-index: 40;
}
.wordmark { font-weight: 700; letter-spacing: -0.04em; margin-right: 10px; font-size: 15px; }
.wordmark span { color: var(--red); }
.navbtn {
  background: transparent; border: 0; color: #ddd; font-size: 12px; letter-spacing: .06em;
  padding: 8px 10px; border-radius: 4px; font-weight: 600;
}
.navbtn.active, .navbtn:hover { background: #2a2a2a; }
.navbtn .caret { opacity: .7; font-size: 9px; margin-left: 4px; }
.spacer { flex: 1; }

.iconbtn {
  background: transparent; border: 0; color: #ddd; width: 32px; height: 32px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: #2a2a2a; }

.menu {
  position: absolute; background: #1c1c1c; border: 1px solid #333; border-radius: 6px;
  min-width: 220px; padding: 6px 0; box-shadow: var(--shadow); z-index: 50;
}
.menu button, .menu .mi {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  color: #eee; padding: 8px 14px; font-size: 13px;
}
.menu button:hover, .menu .mi:hover { background: var(--red); }
.menu .danger { color: #ff8d8d; }
.menu .danger:hover { color: white; }
.nav-anchor { position: relative; }

.shell { display: flex; flex: 1; min-height: 0; }
.rail {
  width: var(--rail); background: #161616; border-right: 1px solid #2a2a2a;
  display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 4px; flex-shrink: 0;
}
.rail.right { border-right: 0; border-left: 1px solid #2a2a2a; }
.rail button {
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: #bbb;
}
.rail button:hover, .rail button.on { background: #2c2c2c; color: white; }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

.subhead {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; background: var(--bg);
}
.crumbs { color: var(--dim); font-size: 12px; }
.athlete-name { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; background: transparent; border: 0; color: white; padding: 0; }
.athlete-pick { position: relative; display: inline-block; }
.athlete-name { cursor: pointer; }
.athlete-menu { top: 34px; left: 0; min-width: 240px; max-height: 360px; overflow: auto; }
.athlete-menu button.on { background: #2457c5; color: white; }
.sub-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ghost {
  background: transparent; border: 1px solid #3a3a3a; color: #ddd; border-radius: 6px;
  padding: 5px 10px; font-size: 13px;
}
.ghost:hover { background: #2a2a2a; }
.seg { display: flex; border: 1px solid #3a3a3a; border-radius: 6px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: #ddd; padding: 5px 8px; }
.today-pill { background: #2a2a2a; }

.cal-scroll { overflow: auto; padding: 8px 8px 24px; flex: 1; }
.build-cal.mode-week .week { min-height: calc(100% - 4px); }
.build-cal.mode-month .day { min-height: 160px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(160px, 1fr)); gap: 6px; margin-bottom: 12px; }
.week-banner {
  grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  color: #9ec0ef; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.week-note-toggle {
  background: transparent; border: 0; color: #8d8d8d; font-size: 11px; font-weight: 600; padding: 0; letter-spacing: 0;
}
.week-note-toggle:hover { color: #dbe8ff; }
.week-note-preview {
  flex: 1; min-width: 0; color: #9a9a9a; font-size: 11px; font-weight: 400; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-note-private { color: #6f6f6f; font-size: 10px; font-weight: 500; letter-spacing: .02em; }
.week-note {
  flex-basis: 100%; width: 100%; resize: vertical; background: #1b1b1b; border: 1px solid #3a3a3a; border-radius: 6px;
  color: #e6e6e6; font: inherit; font-size: 12px; font-weight: 400; letter-spacing: 0; line-height: 1.4; padding: 6px 8px;
}
.week-note:focus { outline: 2px solid #3d6fd6; border-color: #3d6fd6; }
.week.week-current { outline: 2px solid #3b82f6; border-radius: 10px; padding: 4px; }
.week.week-current .week-banner { color: #dbe8ff; }
.day {
  background: #1b1b1b; border: 1px solid #2c2c2c; border-radius: 8px; min-height: 200px;
  display: flex; flex-direction: column; position: relative; padding: 6px 6px 4px; min-width: 0;
}
.day.focus { outline: 1px solid #3d6fd6; }
.day.day-selected { outline: 2px solid #3b82f6; }
.day.clip-hot { box-shadow: inset 0 0 0 2px #3b82f6; }
.day-date { background: transparent; border: 0; color: inherit; font: inherit; font-weight: inherit; letter-spacing: inherit; padding: 0; cursor: pointer; }
.day.read { cursor: pointer; }
.day.rest-day { cursor: default; }
.day.read .day-title { display: block; }
.day.drop { outline: 2px dashed #3d6fd6; }
.day-items { display: flex; flex-direction: column; }
.ex.is-dragging, .chain-block.is-dragging {
  flex: 0 0 0px; height: 0; min-height: 0; padding: 0; margin: 0; overflow: hidden;
  opacity: 0; pointer-events: none; border: 0;
}
.drag-gap {
  box-sizing: border-box; margin: 3px 0; border: 2px dashed #3d6fd6; border-radius: 6px;
  background: rgba(61, 111, 214, 0.16); flex: 0 0 auto;
}
.day-top { display: flex; justify-content: space-between; align-items: center; color: #d7d7d7; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.day-top .tools { display: flex; gap: 2px; }
.week-label { color: var(--dim); font-size: 11px; margin-top: 2px; }
.day-title {
  background: transparent; border: 0; color: #eee; font-size: 13px; font-weight: 600; padding: 1px 0 3px;
  width: 100%; text-align: left;
}
.day-title.placeholder { color: #8d8d8d; font-weight: 500; }
.recur {
  display: inline-flex; align-items: center; gap: 6px; background: #2a2a2a; color: #ddd;
  border: 0; border-radius: 6px; padding: 2px 8px; font-size: 12px; margin-bottom: 3px;
}
.ex {
  display: flex; gap: 5px; align-items: flex-start; padding: 2px 2px; border-radius: 4px; position: relative; min-width: 0;
}
.ex.editing { background: #1d3358; box-shadow: inset 2px 0 0 #7eb6ff; }
.ex:hover { background: #262626; }
.ex.selected { background: #1d3358; }
.ex.clip-hot, .chain-block.clip-hot { background: #16345c; box-shadow: inset 0 0 0 2px #3b82f6; }
.letter {
  width: 16px; height: 16px; border-radius: 3px; color: #111; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; flex-shrink: 0; margin-top: 1px;
}
.ex-name, .ex-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-name { font-size: 12px; line-height: 1.25; }
.ex-sub { font-size: 11px; color: #9a9a9a; line-height: 1.25; }
.ex-main { flex: 1; min-width: 0; background: transparent; border: 0; color: inherit; text-align: left; padding: 0; }
.ex-tools {
  position: absolute; top: 1px; right: 1px; display: none; align-items: center; gap: 1px;
  background: #262626; border-radius: 4px; padding: 0 2px;
}
.ex:hover .ex-tools, .ex.selected .ex-tools { display: flex; }
.ex.selected .ex-tools { background: #1d3358; }
.ex .trash, .ex .handle { background: transparent; border: 0; color: #aaa; padding: 0 2px; font-size: 11px; }
.check { margin-top: 2px; }
.ex .check { margin: 0 2px; }
.add-ex {
  margin-top: auto; background: transparent; border: 0; color: #bdbdbd; text-align: left;
  padding: 4px 2px; font-size: 12px;
}
.add-ex:hover { color: white; }
.stats { display: flex; gap: 8px; color: #8d8d8d; font-size: 10px; letter-spacing: .04em; padding-top: 2px; }
.stats b { color: #cfcfcf; font-weight: 600; }

.pop {
  position: absolute; z-index: 30; background: #2a2a2a; border: 1px solid #3d3d3d; border-radius: 8px;
  box-shadow: var(--shadow); width: 280px; padding: 8px;
}
.search-pop { left: 8px; bottom: 36px; visibility: hidden; }
.search-pop.is-fixed {
  position: fixed; z-index: 60; display: flex; flex-direction: column; overflow: hidden;
  visibility: hidden;
}
.search-pop.is-placed { visibility: visible; }
.search-pop .search-results { margin-top: 6px; }
.search-pop.is-fixed .search-results { overflow: auto; min-height: 0; }
.search-pop input, .field, .editor input[type="text"], .editor input[type="number"] {
  width: 100%; background: #1b1b1b; border: 1px solid #444; border-radius: 6px; padding: 7px 8px; font-size: 13px;
}
.search-pop input:focus { outline: 2px solid #7eb6ff; border-color: #7eb6ff; }

.dose-switch { display: inline-flex; align-items: center; gap: 4px; }
.set-val { display: flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; }
.set-val .sec-suffix { color: #9a9a9a; font-size: 12px; flex: 0 0 auto; }
.unit-set { display: inline-flex; align-items: center; gap: 6px; color: #ddd; font-size: 12px; }
.unit-set select { background: #1c1c1c; color: #ddd; border: 1px solid #3a3a3a; border-radius: 6px; padding: 5px 8px; }
#app.light .unit-set { color: #333; }
#app.light .unit-set select { background: #fff; color: #222; border-color: #ccc; }
.opt {
  display: flex; width: 100%; text-align: left; background: transparent; border: 0; color: #eee;
  padding: 7px 8px; border-radius: 5px; font-size: 13px; gap: 8px; align-items: center;
}
.opt:hover, .opt.active { background: #3a4558; }
.opt .tag { margin-left: auto; color: #999; font-size: 11px; }
.opt.chain-opt { background: #1c2a40; }
.chain-mark {
  background: #2457c5; color: #fff; border-radius: 4px; font-size: 10px; font-weight: 700;
  letter-spacing: .03em; padding: 1px 5px; flex: 0 0 auto;
}
.chain-block {
  border: 1px solid #3d6ea8; border-radius: 6px; margin: 3px 0; padding: 2px 2px 1px; background: #1a2433;
  cursor: grab;
}
.chain-head { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 1px 2px 2px; font-size: 12px; color: #c5d8f2; }
.chain-head .chain-trash { margin-left: auto; color: #aaa; }
.chain-head .chain-trash:hover { color: #f87171; }
.chain-head button { background: transparent; border: 0; color: #9ec0ef; font-size: 11px; padding: 0; }
.chain-title { font-weight: 650; background: transparent; border: 0; color: inherit; padding: 0; cursor: pointer; text-align: left; }
.chain-block.chain-selected { outline: 2px solid #7eb6ff; }
.chain-block.is-collapsed { padding-bottom: 4px; }
.chain-fold { background: transparent; border: 0; color: #9ec0ef; width: 16px; }
.chain-field { display: inline-flex; align-items: center; gap: 4px; color: #bbb; font-size: 12px; }
.chain-field input { width: 72px; background: #1b1b1b; color: #eee; border: 1px solid #444; border-radius: 4px; padding: 3px 6px; }
.chain-field.chain-notes input { width: 160px; }
.athlete-player { display: block; width: min(420px, 100%); margin: 8px 0; background: #111; color: #fff; border: 0; border-radius: 8px; min-height: 84px; }
.athlete-player.playing { position: relative; padding-top: 56.25%; }
.athlete-player.playing iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.circuit-entry { padding: 8px; }
.circuit-field { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: #ccc; }
.circuit-field input { flex: 1; }
.chain-member { display: flex; gap: 6px; align-items: center; padding: 4px 0; font-size: 13px; }
.chain-member button { background: transparent; border: 0; color: #9ec0ef; }
.chain-library { margin-top: 22px; }
.chain-library h2 { margin: 0; font-size: 18px; }
#app.light .chain-mark { background: #2457c5; }
.create-row { border-top: 1px solid #3a3a3a; margin-top: 4px; padding-top: 4px; }

.editor {
  position: fixed; z-index: 35; top: 76px; left: 50%; transform: translateX(-42%);
  width: min(540px, 94vw);
  max-height: calc(100vh - 96px); overflow: auto;
  background: #242424; border: 1px solid #3a3a3a; border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px 12px;
}
.editor.build-editor {
  top: 60px; left: 8px; transform: none;
  width: min(560px, calc(100vw - 16px));
  max-height: none; overflow: visible; padding: 8px 10px 10px; font-size: 12px;
  visibility: hidden;
}
.editor.build-editor.is-placed { visibility: visible; }
.editor.build-editor .editor-h { gap: 6px; }
.editor.build-editor .name-input { font-size: 13px; }
.editor.build-editor .row { margin: 3px 0; gap: 5px; }
.editor.build-editor .linkish { padding: 2px 0; font-size: 11px; }
.editor.build-editor .hint { font-size: 11px; }
.editor.build-editor .pill { padding: 3px 7px; font-size: 11px; }
.editor.build-editor .editor-actions { margin-top: 4px; }
.editor.build-editor .sets-row .hint { display: none; }
.prop-scroll { overflow-x: auto; }
.sets-line { display: flex; align-items: center; gap: 8px; }
.sets-row { flex: 1; margin: 4px 0; }
.sets-label { min-width: 42px; }
.prop-anchor, .superset-anchor, .menu-anchor { position: relative; }
.prop-anchor { margin-left: auto; }
.kbd { color: #9a9a9a; font-size: 11px; margin-left: 4px; }
.prop-menu { right: 0; top: 30px; left: auto; width: 200px; padding: 6px; }
.prop-menu-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 6px; color: #eee; font-size: 13px; }
.prop-menu-h span { color: #999; font-size: 11px; }
.about-prop { border-top: 1px solid #3a3a3a; margin-top: 4px; color: #cfcfcf; }
.letter-pop { right: 8px; top: 36px; width: 72px; padding: 4px; }
.options-pop { left: 0; top: 28px; width: 180px; }
.superset-pop { left: 0; top: 28px; width: 220px; max-height: 220px; overflow: auto; }
.superset-anchor { display: flex; align-items: center; gap: 6px; }
.reps-info { width: 16px; font-size: 11px; color: #9ab; }
.editor-actions { margin-top: 8px; }
.modal.edit-modal { max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
.modal.edit-modal .edit-fields { overflow: auto; min-height: 0; padding-bottom: 4px; }
.modal.edit-modal .full { flex-shrink: 0; }
.editor-h { display: flex; align-items: center; gap: 8px; }
.editor-h .name, .name-input { font-weight: 700; flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid #444; color: white; padding: 2px 4px; }
.editor textarea { width: 100%; min-height: 72px; background: #1b1b1b; border: 1px solid #444; border-radius: 6px; padding: 6px; color: #eee; }

.editor-h .grow { flex: 1; }
.linkish { background: transparent; border: 0; color: #7eb6ff; font-size: 12px; padding: 4px 0; }
.row { display: flex; align-items: center; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 6px; background: #1c1c1c; border-radius: 6px; padding: 2px 6px; }
.stepper button { background: transparent; border: 0; color: white; font-size: 16px; width: 22px; }
.prop-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.prop-table th { color: #999; font-weight: 500; text-align: left; padding: 2px; }
.prop-table input { width: 54px; background: #1b1b1b; border: 1px solid #444; border-radius: 4px; padding: 4px; }
.editor.build-editor .prop-table { width: auto; min-width: 100%; font-size: 12px; margin: 4px 0; }
.editor.build-editor .prop-table th { padding: 2px 4px; white-space: nowrap; }
.editor.build-editor .prop-table th:first-child { width: 96px; }
.editor.build-editor .prop-table th:not(:first-child) { min-width: 60px; }
.editor.build-editor .prop-table input {
  width: 100%; min-width: 0; font-size: 13px; padding: 4px 6px;
}
.editor.build-editor .prop-table .set-val input { flex: 1 1 auto; width: 0; min-width: 0; }
.editor.build-editor .prop-table input:focus {
  outline: 2px solid #7eb6ff; border-color: #7eb6ff;
}
.pill {
  background: #1c1c1c; border: 1px solid #3a3a3a; color: #ddd; border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.pill.on { background: #24344f; border-color: #3d6fd6; }
.note-line { color: #cfcfcf; font-size: 12px; margin: 2px 0 6px; }
.q { font-size: 13px; padding: 3px 0; color: #ddd; }
.detail { white-space: pre-wrap; color: #c7c7c7; font-size: 12px; margin: 4px 0 8px; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(520px, 96vw); background: #2a2a2a; border: 1px solid #444; border-radius: 10px; padding: 16px 16px 14px;
  box-shadow: var(--shadow); color: #f3f3f3;
}
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal .sub { color: #aaa; font-size: 12px; margin-bottom: 8px; }
.modal input, .modal textarea, .modal select { color: #f3f3f3; }
.modal textarea { width: 100%; min-height: 90px; background: #1b1b1b; border: 1px solid #555; border-radius: 6px; padding: 8px; }
.modal label.edit-field { display: block; margin-top: 10px; text-align: left; }
.modal div.edit-field { margin-top: 10px; text-align: left; }
.modal div.edit-field .edit-label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #e8e8e8; }
.modal .edit-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.modal label.edit-field span { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #e8e8e8; }
.modal .full {
  width: 100%; margin-top: 8px; background: #3a3a3a; border: 1px solid #555; border-radius: 6px; padding: 9px; font-weight: 700; color: #f3f3f3;
}
.modal .scope-choice {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; font-weight: 500;
}
.modal .scope-choice strong { font-weight: 700; }
.modal .scope-choice .sub { margin: 0; color: #c8c8c8; font-weight: 400; line-height: 1.35; white-space: normal; }
.modal .full.primary { background: #4a4a4a; }
.modal .full.save { background: var(--green); border-color: #178a48; color: #fff; }
.modal .full.red { background: var(--red); border-color: var(--red); color: #fff; }
.modal label.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.split { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

.hint { color: #999; font-size: 12px; }

.sidebar {
  width: 250px; background: #161616; border-right: 1px solid #2a2a2a; padding: 12px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar h4 { margin: 8px 0 4px; font-size: 12px; color: #aaa; font-weight: 600; }

.preview {
  width: 320px; background: #141414; border-right: 1px solid #2a2a2a; display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 48px; height: calc(100vh - 48px); align-self: flex-start; overflow: hidden;
}
.preview-scroll { flex: 1; overflow: auto; padding: 14px 14px 8px; min-height: 0; }
.preview-date { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #eee; font-weight: 650; margin-bottom: 10px; }
.preview-date button { background: transparent; border: 0; color: #ddd; font-size: 18px; width: 28px; }
.preview-athlete { width: 100%; background: #1c1c1c; color: #eee; border: 1px solid #333; border-radius: 8px; padding: 8px; margin-bottom: 12px; }
.preview-sec, .preview-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: transparent; border: 0; color: #eee; padding: 7px 2px; }
.preview-row:hover { background: #1e1e1e; border-radius: 8px; }
.preview-sec strong, .preview-row b { display: block; font-size: 13px; font-weight: 650; }
.preview-sec small, .preview-row small { display: block; color: #8d8d8d; font-size: 11px; margin-top: 2px; }
.preview-tick {
  width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: white;
  display: grid; place-items: center; font-size: 11px; flex-shrink: 0; margin-top: 2px;
}
.preview-entry {
  margin: 8px 12px 12px; background: #1b1b1b; color: #eee; border: 1px solid #333; border-radius: 8px; padding: 10px; font-weight: 650;
}
.preview-title { text-align: center; font-weight: 700; font-size: 16px; padding: 28px 8px 8px; }
.preview-vid {
  display: block; width: 100%; height: 148px; border: 0; border-radius: 10px; padding: 0; position: relative; overflow: hidden;
  background: #111 center/cover no-repeat; color: white; cursor: pointer;
}
.preview-vid .play { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); }
.preview-vid-title { position: absolute; left: 10px; right: 10px; bottom: 10px; text-align: center; font-weight: 700; text-shadow: 0 1px 4px #000; }
.preview-vid.playing { cursor: default; }
.preview-vid iframe, .preview-vid video { width: 100%; height: 100%; border: 0; background: #000; }
.play { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 800; }
.preview-max { color: #9a9a9a; font-size: 11px; margin-top: 8px; }
.preview-progress { display: flex; align-items: center; margin: 8px 0 10px; }
.preview-progress .knob {
  width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: white;
  display: grid; place-items: center; font-size: 11px; z-index: 1;
}
.preview-progress .track { flex: 1; height: 3px; background: var(--green); border-radius: 2px; margin-left: -2px; }
.preview-actions { display: flex; gap: 6px; margin-bottom: 12px; }
.preview-actions .act {
  flex: 1; background: #1c1c1c; border: 1px solid #2e2e2e; color: #cfcfcf; border-radius: 8px;
  padding: 7px 4px; font-size: 10px; letter-spacing: .04em; font-weight: 700;
}
.preview-actions .optout { color: #e06a6a; }
.preview-actions .journal { color: #7dcea0; }
.preview-actions .act.on { border-color: #e06a6a; background: #2a1515; }
.preview-sheet {
  background: #1b1b1b; border: 1px solid #2a2a2a; border-radius: 12px; padding: 14px 12px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.preview-copy { white-space: pre-wrap; text-align: center; color: #d5d5d5; font-size: 13px; width: 100%; }
.preview-sets { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; }
.preview-sets th { color: #9a9a9a; font-weight: 650; font-size: 10px; letter-spacing: .06em; text-align: center; padding-bottom: 6px; }
.preview-sets td { text-align: center; padding: 4px 2px; color: #eee; }
.preview-box {
  display: inline-flex; min-width: 46px; justify-content: center; border: 1px solid #5c5c5c;
  border-radius: 8px; padding: 6px 8px; color: #f2f2f2; background: #161616;
}

.tabs button.on { background: #3a3a3a; }
.complete {
  width: 100%; background: var(--green); color: white; border: 0; border-radius: 8px; padding: 10px; font-weight: 700; margin-top: 8px;
}
.preview .complete {
  width: auto; min-width: 140px; border-radius: 999px; padding: 8px 18px; margin-top: 6px;
}
.preview .complete.done { background: #146b38; }
.preview-nav { display: flex; justify-content: center; gap: 28px; padding: 10px 8px 14px; }
.preview-nav .iconbtn { color: #eee; font-size: 18px; }
.preview-nav .iconbtn:disabled { opacity: .35; }
.preview-sheet .q { width: 100%; text-align: left; }
.sets { width: 100%; border-collapse: collapse; font-size: 13px; }
.sets th { color: #999; font-weight: 500; font-size: 11px; text-align: left; }
.sets td { padding: 4px 2px; }
.sets input { width: 64px; background: #111; border: 1px solid #444; border-radius: 4px; padding: 4px; color: #eee; }
.sets input[type="checkbox"] { width: auto; }
.light-page .sets input, .light-page .sets td { background: #fff; color: #222; border-color: #ccc; }

.saved-pill { color: #8ee0a8; font-size: 11px; margin: -2px 0 6px; }

.athlete-banner .ghost { color: white; border-color: #3d6b4e; }
.toast {
  position: fixed; top: 60px; right: 64px; background: #137a3a; color: white; padding: 10px 14px;
  border-radius: 8px; z-index: 70; font-size: 13px; box-shadow: var(--shadow);
}

.light-page { padding: 18px 20px 40px; overflow: auto; flex: 1; }
.light-page h1 { font-size: 26px; margin: 0 0 4px; font-weight: 650; }
.filters { display: flex; gap: 8px; align-items: center; color: #666; font-size: 13px; }
select.plain, input.plain {
  background: white; border: 1px solid #ddd; border-radius: 8px; padding: 7px 8px; color: #222;
}

.card .who { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #444; }

.group-codes .hint { margin: 0; }

.comment { background: transparent; border: 0; color: #666; font-size: 13px; padding: 0; }

.empty { display: grid; place-items: center; min-height: 320px; color: #888; text-align: center; }

.panel { background: white; border-radius: 12px; padding: 12px; color: #222; box-shadow: 0 1px 2px rgba(0,0,0,.05); }

.switch { background: #2f6fed; color: white; border: 0; border-radius: 8px; padding: 6px 8px; font-size: 11px; font-weight: 700; }

.weekstrip .d { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: #333; }
.weekstrip .d.on { background: #1b1b1b; color: white; }
.entry-item { display: flex; gap: 8px; padding: 8px 4px; border-bottom: 1px solid #f0f0f0; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: #222; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.users { display: grid; grid-template-columns: 200px 1fr; min-height: 0; flex: 1; }
.users nav { background: #1b1b1b; color: #eee; padding: 10px 0; }
.users nav button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: #ddd; padding: 8px 14px; }
.users nav button.on { background: #333; }
.users nav .sec { color: #888; font-size: 11px; letter-spacing: .08em; padding: 12px 14px 4px; }

table.data { width: 100%; border-collapse: collapse; background: white; color: #222; font-size: 13px; }
table.data th { text-align: left; font-size: 11px; letter-spacing: .04em; color: #666; padding: 8px; border-bottom: 1px solid #e5e5e5; }
table.data td { padding: 8px; border-bottom: 1px solid #f0f0f0; }
table.data tr:hover td { background: #fafafa; }

.compose { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }

.mode { display: flex; border-radius: 8px; overflow: hidden; }
.mode button { border: 0; padding: 8px 14px; font-weight: 800; background: white; }
.mode button.on { background: var(--green); color: white; }
.group-pop { position: absolute; background: white; color: #222; border: 1px solid #ddd; border-radius: 8px; width: 260px; z-index: 20; max-height: 240px; overflow: auto; }
.group-pop button { display: block; width: 100%; text-align: left; background: white; border: 0; padding: 8px 10px; color: #222; }
.group-pop button:hover { background: #f3f3f3; }

.history { font-size: 12px; color: #bbb; padding: 4px 0; border-bottom: 1px solid #2a2a2a; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: #ddd;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.nav-links { display: contents; }
.nav-drawer, .nav-backdrop { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-label { color: #888; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 12px 10px 4px; }
.drawer-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 1100px) {

  .week { grid-template-columns: repeat(7, 180px); }
}
@media (max-width: 900px) {
  .rail { display: none; }
  .topnav .nav-links,
  .topnav .role-switch,
  .topnav .nav-profile { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .nav-backdrop.open { opacity: 1; pointer-events: auto; }
  .nav-drawer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    background: #111;
    z-index: 80;
    transform: translateX(-105%);
    transition: transform .22s ease;
    padding: 12px;
    overflow: auto;
    box-shadow: 12px 0 40px rgba(0,0,0,.4);
  }
  .nav-drawer.open { transform: translateX(0); }
  .nav-drawer .navbtn { display: block; width: 100%; text-align: left; }
  .nav-drawer .role-switch { flex-wrap: wrap; margin: 0 0 8px; }
  .nav-drawer .nav-profile { border: 0; margin: 0; padding: 0; }
}

/* Nav User Profile & Role Badges */
.nav-profile {
  display: flex; align-items: center; gap: 10px; margin-left: auto; padding-left: 12px;
  border-left: 1px solid #2a2a2a; position: relative;
}
.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; text-transform: uppercase;
}
.nav-user-info { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.nav-user-name { font-size: 12px; font-weight: 700; color: #eee; white-space: nowrap; }
.role-badge {
  display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; letter-spacing: 0.5px;
}
.role-badge.coach { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.role-badge.athlete { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.4); }
.role-badge.admin { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.nav-logout-btn {
  background: transparent; border: 1px solid #333; color: #aaa; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.nav-logout-btn:hover { border-color: #ef4444; color: #f87171; background: rgba(239, 68, 68, 0.1); }

.view-pill {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 4px 8px; border-radius: 999px;
  border: 1px solid #333; color: #ddd;
}
.view-pill.admin { color: #f87171; border-color: rgba(239, 68, 68, 0.5); }
.view-pill.coach { color: #60a5fa; border-color: rgba(59, 130, 246, 0.5); }
.view-pill.athlete { color: #4ade80; border-color: rgba(34, 197, 94, 0.5); }
.role-switch { display: flex; gap: 4px; margin-right: 8px; }
.role-switch button {
  background: transparent; color: #aaa; border: 1px solid #333; border-radius: 999px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 4px 8px; cursor: pointer;
}
.role-switch button.on { color: #fff; border-color: #22c55e; }

.join-code { font-size: 18px; font-weight: 800; letter-spacing: .12em; background: #111; color: #fff; padding: 6px 10px; border-radius: 8px; }

.note-box { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.note-box .hint { margin: 0; }
.note-box .ui-label { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #bbb; }
.note-box textarea {
  min-height: 72px; border-radius: 8px; border: 1px solid #333; background: #111; color: #fff; padding: 8px;
}
.light-page .note-box .ui-label { color: var(--ui-text-2); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; }
.light-page .note-box textarea { background: #fff; color: #222; border-color: #ddd; }
.editor.log-editor { width: min(720px, 96vw); }
.group-card .member-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #eee; }

.team-action.add { background: #111; color: #fff; }

.goal-assignee-tag.team { color: #fbbf24; background: rgba(251, 191, 36, 0.15); }

/* Build side panel: library, PRs & goals, action history */
.build-panel {
  width: 300px; flex-shrink: 0; background: #161616; border-right: 1px solid #2a2a2a; color: #eee;
  display: flex; flex-direction: column; min-height: 0; font-size: 13px;
}
.bp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 14px; }
.bp-head strong { font-size: 14px; }
.bp-tools { display: flex; flex-direction: column; gap: 6px; padding: 4px 12px 10px; border-bottom: 1px solid #262626; }
.bp-tools input, .bp-tools select {
  width: 100%; background: #1f1f1f; color: #eee; border: 1px solid #383838; border-radius: 6px; padding: 7px 9px; font-size: 13px;
}
.bp-tools input:focus { outline: none; border-color: #7eb6ff; }
.bp-tools .ghost:disabled { opacity: .4; cursor: default; }
.bp-note { color: #8d8d8d; font-size: 11px; line-height: 1.4; }
.bp-note b { color: #cfcfcf; font-weight: 600; }
.bp-scroll { flex: 1; overflow: auto; padding: 4px 6px 12px; min-height: 0; }
.bp-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; padding: 6px 6px; border-radius: 6px; }
.bp-row:hover, .bp-row.open { background: #1e1e1e; }
.bp-main { flex: 1; min-width: 0; background: transparent; border: 0; color: inherit; text-align: left; padding: 0; }
.bp-main b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-main small { display: block; color: #8d8d8d; font-size: 11px; margin-top: 1px; }
.bp-add {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; border: 1px solid #3a3a3a; background: transparent; color: #ccc;
  display: grid; place-items: center; font-size: 13px; opacity: 0; transition: opacity .1s;
}
.bp-row:hover .bp-add, .bp-row.open .bp-add, .bp-add:focus { opacity: 1; }
.bp-add:hover { background: var(--green); border-color: var(--green); color: #fff; }
.bp-detail { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; padding: 4px 0 2px; color: #cfcfcf; font-size: 12px; }
.bp-detail span { display: inline-block; width: 64px; color: #8d8d8d; }
.bp-detail p { margin: 2px 0; white-space: pre-wrap; color: #bdbdbd; }
.bp-detail a { color: #7eb6ff; text-decoration: none; }
.bp-detail .ghost { align-self: flex-start; margin-top: 4px; font-size: 12px; }
.bp-group { color: #9ec0ef; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 10px 6px 2px; }
.bp-best { font-weight: 600; white-space: nowrap; padding-top: 1px; }
.bp-goal { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #8d8d8d; font-size: 11px; }
.bp-bar { flex: 1; height: 4px; background: #2c2c2c; border-radius: 4px; overflow: hidden; }
.bp-bar i { display: block; height: 100%; background: var(--red); }
.bp-bar.hit i { background: var(--green); }
.bp-hist { padding: 7px 6px; border-bottom: 1px solid #222; color: #ddd; }
.bp-hist span { display: block; color: #777; font-size: 11px; }
.bp-empty { color: #8d8d8d; padding: 16px 8px; text-align: center; }
.bp-foot { padding: 10px 12px; border-top: 1px solid #262626; }
