:root {
  --ink: #1c2a2e;
  --ink-soft: #4d5c60;
  --paper: #fbfaf7;
  --card: #ffffff;
  --line: #e2e0da;
  --accent: #2f6f5e;
  --accent-soft: #e8f2ef;
  --flag: #b3541e;
  --flag-soft: #fbeee3;
  --radius: 10px;

  /* Marker bands — client-facing names only (Work On, Priority Focus,
     Urgent), never the internal ones (Monitor, Concern, Act Now).
     Gradient from green (best) through to red (most severe). */
  --band-optimal:        #1f7a52;
  --band-optimal-soft:   #d9f2e6;
  --band-good:           #0d7a7a;
  --band-good-soft:      #d9f0f0;
  --band-acceptable:     #8a6d1f;
  --band-acceptable-soft: #faf1cf;
  --band-workon:         #b3661e;
  --band-workon-soft:    #fbe8d4;
  --band-priorityfocus:  #b8511f;
  --band-priorityfocus-soft: #f7e0cf;
  --band-urgent:         #8f1d29;
  --band-urgent-soft:    #f3bfc6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.page.wide {
  max-width: 1400px;
}

.page.medium {
  max-width: 760px;
}

nav.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.nav-client-name {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Below this width, an absolutely-centered name collides with the nav
   links (confirmed by testing at 900/768px — text actually overlapped).
   Drop it onto its own centered line under the links instead. */
@media (max-width: 960px) {
  nav.top {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .nav-client-name {
    position: static;
    transform: none;
    flex-basis: 100%;
    text-align: center;
  }
}

nav.top a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

nav.top a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

h1 {
  font-size: 22px;
  margin: 4px 0 2px;
}

.week-label {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.load-description {
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 14px;
}

.insight {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

/* Insights feed — one card per entry, most recent first. */

.insight-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.insight-text {
  font-size: 15px;
  color: var(--ink);
  margin: 0;
}

.session-group h3 {
  font-size: 15px;
  margin: 20px 0 8px;
}

.session-group:first-child h3 {
  margin-top: 0;
}

.session-group .detail {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.video-link {
  font-size: 13px;
  margin: 0 0 10px;
}

.video-link a {
  color: var(--accent);
  font-weight: 600;
}

.video-link.placeholder {
  color: var(--ink-soft);
  font-style: italic;
}

/* Nested inside a compact session card instead of the wider group-level
   spacing above. */
.row-body .video-link {
  font-size: 12px;
  margin: 2px 0 0;
}

.session-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.session-row:first-of-type {
  border-top: none;
}

.session-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.session-row .row-body {
  flex: 1;
}

.session-row label {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: block;
}

.session-row .note-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  padding: 2px 0;
  cursor: pointer;
}

.session-row textarea.note {
  display: none;
  width: 100%;
  margin-top: 6px;
  font-size: 13px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
}

.session-row textarea.note.visible {
  display: block;
}

/* Compact session layout — several instances of the same mechanism sit
   side by side instead of stacked, so e.g. three aerobic sessions read as
   one row of cards rather than a tall list. */
.chip-row,
.day-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.session-row.chip {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  flex: 1 1 150px;
}

.session-row.chip .chip-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.session-row.chip input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.session-row.chip label {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: block;
}

.session-row.chip .chip-detail {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 2px 0 0;
}

.session-row.chip .note-toggle {
  display: block;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  padding: 4px 0 0;
  cursor: pointer;
}

.session-row.chip textarea.note {
  display: none;
  width: 100%;
  margin-top: 6px;
  font-size: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font-family: inherit;
}

.session-row.chip textarea.note.visible {
  display: block;
}

/* Post-dinner movement — a row of plain unlabeled checkboxes standing in
   for the days of the week; the shared description above the row already
   explains what each one means. */
.session-row.day {
  padding: 0;
  border: none;
}

.session-row.day input[type="checkbox"] {
  width: 34px;
  height: 34px;
  accent-color: var(--accent);
  cursor: pointer;
}

label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 16px 0 6px;
}

textarea,
select,
input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.bp-row {
  display: flex;
  gap: 10px;
}

.bp-row > div {
  flex: 1;
}

/* Look Forward — activity grid, per-type follow-up panel, added-activity
   tags, and the week-feel/energy button-cards. */

.activity-tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.activity-tags:empty {
  margin-bottom: 0;
}

.activity-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.activity-tag .remove-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.activity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
}

.activity-card:hover {
  border-color: var(--accent);
}

.activity-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.activity-label {
  font-size: 13px;
  font-weight: 600;
}

.activity-panel-card:empty {
  display: none;
}

.activity-panel-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

.activity-panel-card input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--ink);
}

.pill.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.add-activity-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.add-activity-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 16px;
}

.choice-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
}

.choice-card:hover {
  border-color: var(--accent);
}

.choice-card.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.choice-label {
  font-size: 14px;
  font-weight: 700;
}

.choice-detail {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

@media (max-width: 480px) {
  .activity-grid,
  .choice-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

button.submit {
  width: 100%;
  padding: 14px;
  margin-top: 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

button.submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.status-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.status-message.error {
  color: var(--flag);
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
}

/* Narrative page */

.narrative-card h2.trajectory-heading {
  font-size: 20px;
  margin: 0 0 6px;
  color: var(--accent);
}

.narrative-card h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin: 24px 0 10px;
}

.narrative-card h3:first-of-type {
  margin-top: 4px;
}

.narrative-card p {
  font-size: 15px;
  margin: 0 0 14px;
}

.narrative-card hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.narrative-card a {
  color: var(--accent);
}

/* Marker table page */

.table-card {
  overflow-x: auto;
  padding: 0;
}

table.marker-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  white-space: nowrap;
}

table.marker-table th,
table.marker-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

table.marker-table th {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  position: sticky;
  top: 0;
}

table.marker-table tr.group-row td {
  background: var(--paper);
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

/* Band legend + inline band pills — shared between the legend key and the
   colour-coded text inside table cells, so they visually match. */

.band-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.band-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.band-pill.band-optimal        { background: var(--band-optimal-soft); color: var(--band-optimal); }
.band-pill.band-good           { background: var(--band-good-soft); color: var(--band-good); }
.band-pill.band-acceptable     { background: var(--band-acceptable-soft); color: var(--band-acceptable); }
.band-pill.band-workon         { background: var(--band-workon-soft); color: var(--band-workon); }
.band-pill.band-priorityfocus  { background: var(--band-priorityfocus-soft); color: var(--band-priorityfocus); }
.band-pill.band-urgent         { background: var(--band-urgent-soft); color: var(--band-urgent); }

/* Fixed-width wrapper around a cell's value/range text, so the pill that
   follows lines up in a consistent column across rows regardless of how
   long each row's value text happens to be. */
.cell-value {
  display: inline-block;
  min-width: 112px;
}

.table-intro p {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 10px;
}

.table-intro p:last-child {
  margin-bottom: 20px;
}

.table-footnote {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 12px;
}

.table-footnote a {
  color: var(--accent);
}
