:root {
  color-scheme: light;
  --page: #e9edfb;
  --phone: #fbfbfd;
  --surface: #ffffff;
  --field: #f6f6f7;
  --text: #171717;
  --muted: #85858c;
  --line: #eeeeef;
  --black: #111111;
  --lavender: #eeeafb;
  --peach: #fff1e9;
  --blue: #e8f7fd;
  --mint: #eaf8f0;
  --shadow: 0 28px 80px rgba(81, 88, 135, 0.18);
  --soft-shadow: 0 12px 34px rgba(24, 24, 28, 0.07);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 24rem),
    linear-gradient(135deg, #edf1ff 0%, #e8ecfb 48%, #f4f1fb 100%);
  color: var(--text);
}

body.legal-page {
  background: #f7f8fc;
}

.legal-shell {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.legal-shell h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: 46px;
  line-height: 1;
}

.legal-shell h2 {
  margin: 34px 0 10px;
  font-size: 22px;
}

.legal-shell p {
  color: #4f4f59;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.6;
}

.legal-shell a {
  color: #171717;
  font-weight: 850;
}

.legal-muted {
  margin-bottom: 28px;
  color: #85858c !important;
}

.legal-back {
  display: inline-flex;
  margin-bottom: 26px;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(460px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 22px 18px 92px;
  border: 10px solid rgba(255, 255, 255, 0.64);
  border-radius: 42px;
  background: var(--phone);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #d9d9de;
  transform: translateX(-50%);
}

.phone-panel,
.summary-strip,
.workspace,
.bottom-nav {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.topbar {
  display: grid;
  gap: 18px;
  padding-top: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #77777f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  max-width: 360px;
  margin-bottom: 8px;
  font-size: 36px;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  letter-spacing: 0;
}

.subtitle {
  max-width: 350px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.purpose-copy {
  max-width: 380px;
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f4f4f6;
  color: #4f4f59;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.public-purpose {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(238, 238, 239, 0.85);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.public-purpose h2 {
  margin: 0;
  font-size: 20px;
}

.public-purpose p {
  margin: 0;
  color: #4f4f59;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.public-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.public-links a {
  border-radius: 999px;
  padding: 8px 12px;
  background: #f4f4f6;
  color: #171717;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.auth-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.google-button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  background: var(--black);
  color: #fff;
  box-shadow: var(--soft-shadow);
}

.google-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.google-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 900;
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.profile span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 18px;
  background: #1c1c1e;
  color: #fff !important;
  font-weight: 900;
}

.hidden,
body[data-role="athlete"] .coach-panel {
  display: none;
}

body.logged-out .app-shell {
  display: grid;
  min-height: calc(100vh - 28px);
  align-content: center;
}

body.logged-out .topbar {
  gap: 28px;
  padding-top: 0;
}

body.logged-out .summary-strip,
body.logged-out .workspace,
body.logged-out .bottom-nav,
body.logged-out .profile {
  display: none;
}

body.logged-in .public-purpose {
  display: none;
}

body.logged-out .auth-card {
  margin-top: 10px;
}

body.logged-in .google-button {
  display: none;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 16px;
}

.summary-card {
  min-height: 96px;
  padding: 16px;
  border-radius: 16px;
  background: #f4f4f8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.summary-card span {
  display: block;
  margin-bottom: 18px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.summary-card p {
  margin: 0;
  color: #5c5c64;
  font-size: 12px;
  font-weight: 800;
}

.summary-card.lavender {
  background: var(--lavender);
}

.summary-card.peach {
  background: var(--peach);
}

.summary-card.mint {
  background: var(--mint);
}

.workspace {
  display: grid;
  gap: 14px;
}

.coach-panel,
.planner {
  border: 1px solid rgba(238, 238, 239, 0.8);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
}

.coach-panel {
  order: 1;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.coach-extra {
  display: none;
  gap: 14px;
  padding-top: 4px;
}

.section-label {
  margin-bottom: 8px;
  color: #71717a;
  font-size: 13px;
  font-weight: 900;
}

.week-history,
.future-calendar {
  display: grid;
  gap: 8px;
}

.week-history button,
.future-calendar button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.week-history button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 13px;
  border-radius: 16px;
  background: #f7f7f8;
  color: var(--text);
  text-align: left;
}

.week-history button span,
.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.future-calendar {
  grid-template-columns: repeat(4, 1fr);
}

.future-calendar button {
  min-height: 44px;
  border-radius: 14px;
  background: #f7f7f8;
  color: #6b6b73;
  font-size: 12px;
  font-weight: 900;
}

.future-calendar button.active {
  background: var(--black);
  color: #fff;
}

.field {
  display: grid;
  gap: 7px;
  color: #71717a;
  font-size: 13px;
  font-weight: 800;
}

.field.compact {
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(238, 238, 239, 0.52);
}

input,
select {
  height: 46px;
  padding: 0 13px;
  font-weight: 750;
}

textarea {
  min-height: 104px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.45;
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #1f1f1f;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
}

.primary-button,
.secondary-button {
  min-height: 50px;
  padding: 0 16px;
}

.primary-button {
  background: var(--black);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #f7f7f8;
  color: var(--black);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.planner {
  order: 2;
  padding: 18px;
  overflow: hidden;
}

.planner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.planner-header h2 {
  max-width: 250px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 11px;
  background: #f1f1f2;
  color: #64646c;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.saved {
  background: #eaf8f0;
  color: #20724c;
}

.days-grid {
  display: grid;
  gap: 12px;
}

.training-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(238, 238, 239, 0.86);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(24, 24, 28, 0.045);
  overflow: hidden;
}

.training-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: #d8d1fa;
}

.training-card.swim::before,
.training-card.swim .type-emoji {
  background: var(--blue);
}

.training-card.bike::before,
.training-card.bike .type-emoji {
  background: var(--peach);
}

.training-card.run::before,
.training-card.run .type-emoji {
  background: var(--lavender);
}

.training-card.yoga::before,
.training-card.yoga .type-emoji {
  background: var(--mint);
}

.training-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-left: 4px;
}

.day-name {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.date-label {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}

.type-emoji {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  font-size: 24px;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.training-card .field {
  margin-bottom: 12px;
}

.readonly-training {
  display: none;
}

.readonly-type {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 900;
}

.readonly-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.readonly-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f5f5f6;
  color: #5d5d65;
  font-size: 12px;
  font-weight: 850;
}

.readonly-task {
  margin: 0;
  color: #303037;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

body[data-role="athlete"] .summary-strip {
  display: none;
}

body[data-role="athlete"] .planner {
  margin-top: 14px;
}

body[data-role="athlete"] .workspace {
  display: block;
}

body[data-role="athlete"] .training-card .field,
body[data-role="athlete"] .training-card .inline-fields {
  display: none;
}

body[data-role="athlete"] .readonly-training {
  display: block;
}

.athlete-calendar-button {
  width: 100%;
  margin-top: 14px;
}

.bottom-nav {
  display: none !important;
  position: fixed;
  left: 50%;
  bottom: 20px;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  width: min(390px, calc(100% - 58px));
  padding: 10px 12px;
  border: 1px solid rgba(238, 238, 239, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(24, 24, 28, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  grid-template-rows: 24px 13px;
  gap: 3px;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 6px 4px;
  place-items: center;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #77777f;
  cursor: pointer;
  font-weight: 800;
}

.bottom-nav .material-symbols-rounded {
  display: block;
  width: 24px;
  height: 24px;
  font-size: 24px;
  line-height: 24px;
}

.bottom-nav button small {
  display: block;
  width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav .nav-add {
  background: var(--black);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

@media (min-width: 880px) {
  .app-shell {
    width: min(1180px, calc(100% - 48px));
    min-height: auto;
    padding: 32px 34px 110px;
    border-radius: 36px;
  }

  .topbar {
    grid-template-columns: 1fr 280px;
    align-items: end;
  }

  h1 {
    max-width: 720px;
    font-size: 52px;
  }

  .subtitle {
    max-width: 540px;
    font-size: 17px;
  }

  .purpose-copy {
    max-width: 560px;
  }

  .public-purpose {
    max-width: 720px;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .workspace {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }

  .coach-panel {
    order: 1;
    position: sticky;
    top: 24px;
  }

  .planner {
    order: 2;
  }

  .days-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (min-width: 1240px) {
  .days-grid {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
  }
}

@media (max-width: 430px) {
  body {
    background: var(--phone);
  }

  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .summary-card.mint {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    bottom: 14px;
    width: calc(100% - 32px);
  }
}
