:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #202720;
  background: #f8f8f4;
  color-scheme: light;
  line-height: 1.5;
  --muted: #505951;
  --line: #cbd1c8;
  --accent: #245442;
  --accent-soft: #eaf2ed;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.shell { width: min(100% - 32px, 740px); margin-inline: auto; }

.journal-header {
  background: #f1f2ec;
  border-bottom: 1px solid #cbd1c8;
}
.journal-identity {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 61px;
  padding-block: 8px;
  overflow: hidden;
}
.brand-name { min-width: 0; overflow-wrap: anywhere; }
.brand-name strong { display: block; font-size: 18px; font-weight: 800; line-height: 1.2; }
.brand-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.coach-signature {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(48%, 220px);
  gap: 3px;
  opacity: .53;
  color: #637b6b;
  pointer-events: none;
  mask-image: linear-gradient(to right, transparent, #000 28%);
}
.coach-signature strong { font-size: 10px; }
.coach-emblem {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  width: 30px;
  height: 23px;
  padding-bottom: 3px;
  color: #486454;
}
.emblem-letter {
  font-size: 13px;
  line-height: 1;
  letter-spacing: -.11em;
  font-weight: 900;
  transform: skewX(-10deg);
}
.emblem-bar {
  position: absolute;
  inset: auto 2px 4px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.emblem-bar::before,.emblem-bar::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 8px;
  top: -3px;
  background: currentColor;
  border-radius: 1px;
}
.emblem-bar::before { left: 4px; }
.emblem-bar::after { right: 4px; }

main { padding-block: 28px calc(138px + env(safe-area-inset-bottom)); }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(32px, 6vw, 46px); line-height: 1.1; margin-bottom: 8px; letter-spacing: -.04em; }
h2 { font-size: 20px; line-height: 1.25; margin-bottom: 10px; }
.sub, .muted { color: var(--muted); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  margin-block: 18px;
}
main > section + section { margin-top: 24px; }
main > section:not([class]) + section:not([class]) { margin-top: 32px; }
.training-hero {
  display: grid;
  gap: 14px;
  padding: 20px;
  margin-block: 22px;
  background: #fff;
  border: 1px solid #aebfb3;
  border-left: 4px solid var(--accent);
  border-radius: 15px;
}
.training-hero p { margin-bottom: 0; color: var(--muted); }
.last-workout { margin: 12px 0; color: var(--muted); font-size: 14px; }
.training-hero .last-workout { grid-column: 1 / -1; border-top: 1px solid #aebfb3; padding-top: 11px; margin-top: 0; }
.daily-card h2, form.card h2, section.card > h2 { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-block: 16px; }
.stats div { background: #f4f5f0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stats dt { font-size: 14px; color: var(--muted); }
.stats dd { font-size: 24px; font-weight: 800; margin: 2px 0 0; }

.tabs {
  position: fixed;
  z-index: 2;
  inset: auto 0 calc(12px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 6px;
  box-shadow: 0 4px 20px #20272020;
}
.tabs button { border: 0; background: transparent; color: var(--muted); min-height: 44px; border-radius: 10px; font-weight: 700; }
.tabs [aria-current] { background: var(--accent); color: #fff; }
.action { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #fff; font-weight: 750; }
.action.secondary { background: #fff; color: var(--accent); }
.action:disabled { background: #eceee8; color: #505951; border-color: var(--line); cursor: default; }
.sticky { position: sticky; bottom: calc(77px + env(safe-area-inset-bottom)); background: #f8f8f4; padding-block: 9px; margin-top: 16px; }

.pills, .meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pills button, .meta span { background: #f4f5f0; color: #303b32; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.pills button { min-height: 44px; font-weight: 700; }
.pills button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.exercise-heading { display: flex; align-items: center; gap: 10px; margin: -18px -18px 14px; padding: 13px 18px; background: #eff2eb; border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; }
.exercise-heading h2 { margin: 0; }
.index { background: #dce9de; border-radius: 5px; padding: 3px 8px; font-size: 13px; font-weight: 800; }
.note { background: var(--accent-soft); border-left: 3px solid #7f9e8a; border-radius: 6px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
.previous { color: var(--muted); font-size: 14px; margin: 12px 0; }

label { display: grid; gap: 5px; font-size: 14px; font-weight: 650; }
input, textarea { width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid #788779; border-radius: 7px; background: #fff; color: inherit; font-size: 16px; }
textarea { resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-block: 16px; }
.set { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-number { align-self: center; font-size: 13px; font-weight: 750; }
.set button { width: 44px; height: 44px; border: 1px solid #788779; border-radius: 8px; background: #fff; color: #354d3d; }
.set button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.set small { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.figure { display: flex; gap: 7px; align-items: flex-end; height: 92px; margin: 12px 0; }
.figure span { background: #4e8069; border-radius: 4px 4px 0 0; flex: 1; min-height: 4px; }
.history { padding-left: 20px; }
.history li { margin: 5px 0; }
#status { position: fixed; inset: auto 0 calc(76px + env(safe-area-inset-bottom)); text-align: center; background: #233e32; color: #fff; z-index: 3; }
#status:not(:empty) { padding: 9px; }

@media (min-width: 610px) {
  .training-hero { grid-template-columns: 1fr auto; align-items: center; }
  .training-hero .action { min-width: 175px; }
}

.cloud-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.cloud-toolbar .action { width: auto; }
.cloud-form { display: grid; gap: 12px; }
.cloud-form fieldset { border: 1px solid var(--line); border-radius: 9px; min-width: 0; margin: 0; }
.cloud-form legend { font-weight: 700; }
.cloud-form select { width: 100%; min-height: 44px; border: 1px solid #788779; border-radius: 7px; padding: 8px; background: white; color: inherit; font: inherit; }
#status.cloud-error { background: #84271f; color: #fff; }
.cloud-link { color: var(--accent); }

.coach-app, body:has(.coach-app) .journal-identity { width: min(100% - 32px, 1136px); }
.coach-page-heading, .roster-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.coach-page-heading { margin-bottom: 22px; }
.coach-page-heading h1 { margin: 0; }
.sign-out { width: auto; flex: none; }
.coach-layout { display: grid; gap: 22px; align-items: start; }
.coach-detail { min-width: 0; }
.coach-roster, .coach-client-heading {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.roster-heading { margin-bottom: 12px; }
.roster-heading h2 { margin: 0; }
.roster-heading span { padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.roster-list { display: grid; gap: 6px; margin-top: 12px; }
.roster-client {
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  text-align: left;
  color: inherit;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 9px;
}
.roster-client[hidden] { display: none; }
.roster-client:hover { background: #f4f5f0; }
.roster-client[aria-pressed="true"] { background: var(--accent-soft); border-color: #789a87; }
.roster-client strong, .roster-client small { display: block; overflow-wrap: anywhere; }
.roster-client small { color: var(--muted); }
.client-avatar { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: #e0eae3; color: var(--accent); font-weight: 750; font-size: 13px; }
.coach-client-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-left: 4px solid var(--accent); }
.coach-client-heading p { margin: 0; color: var(--muted); }
.coach-client-heading .action { width: auto; }
.coach-tools { display: grid; gap: 10px; margin-top: 14px; }
.coach-tools > details { margin: 0; }
.coach-tools > details[open] .cloud-form { margin-top: 14px; }
.coach-plans .cloud-toolbar, .coach-plans p { margin-bottom: 0; }
.session-content { max-width: 740px; margin-inline: auto; }
@media (min-width: 770px) {
  .coach-layout { grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); }
  .coach-roster { position: sticky; top: 16px; }
}
@media (max-width: 400px) {
  .coach-page-heading h1 { font-size: 26px; }
  .coach-page-heading .sign-out { padding-inline: 9px; font-size: 14px; }
}

#import-preview:not(:empty) { margin-top: 18px; }
.import-exercise { display: grid; gap: 8px; padding: 12px 0; }
.import-exercise + .import-exercise { border-top: 1px solid var(--line); }
.import-exercise p { color: var(--muted); font-size: 14px; margin: 0; }
.import-replace { display: flex; align-items: center; gap: 8px; }
.import-replace input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }

.set .remove-set { align-self: end; font-size: 22px; line-height: 1; }
.set .remove-set:hover { color: #84271f; border-color: #a65550; background: #fcf1ee; }
.library-exercises { display: grid; gap: 8px; margin-block: 12px 16px; }
.library-exercise { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.library-exercise summary span { margin-left: 8px; color: var(--muted); font-size: 13px; }
