:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --ink: #202124;
  --muted: #5f6368;
  --subtle: #8a9099;
  --line: #e8eaed;
  --line-strong: #d1d5db;
  --primary: #1a73e8;
  --primary-soft: #e8f0fe;
  --green: #1e8e3e;
  --green-soft: #e6f4ea;
  --yellow: #f9ab00;
  --yellow-soft: #fef7e0;
  --red: #d93025;
  --red-soft: #fce8e6;
  --teal: #0f9d8f;
  --violet: #7e57c2;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Google Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  margin: 0;
  min-height: 100vh;
}

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

button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.22);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

button,
.connect-button,
.logout-button,
.whoop-login-button {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 650;
  min-height: 40px;
  padding: 9px 13px;
  text-align: center;
  text-decoration: none;
  transition:
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 34px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.auth-screen {
  align-items: center;
  background: var(--surface);
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-card {
  align-items: center;
  display: grid;
  gap: 22px;
  justify-items: center;
  max-width: 420px;
  text-align: center;
}

.auth-copy {
  display: grid;
  gap: 10px;
}

.auth-copy h1 {
  font-size: 32px;
}

.auth-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.whoop-login-button {
  background: var(--ink);
  color: #fff;
  min-height: 48px;
  min-width: 190px;
  padding: 13px 20px;
}

.whoop-login-button:hover {
  background: #3c4043;
}

.app-header {
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.app-header-inner {
  align-items: center;
  display: grid;
  gap: 22px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin: 0 auto;
  max-width: 1160px;
  min-height: 64px;
  padding: 0 24px;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 6px;
  min-height: 64px;
  min-width: 0;
  text-decoration: none;
}

.brand strong,
.brand span,
.connection-card strong,
.connection-card span {
  display: block;
}

.brand strong {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.15;
}

.brand > span:first-child {
  color: var(--ink);
  font-size: 15px;
  font-weight: 780;
  letter-spacing: 0;
}

#configStatus {
  display: none;
}

.brand span,
.connection-card span,
.athlete-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.connection-card {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  min-width: 0;
  padding: 0;
}

.connection-card[data-status="connected"] {
  background: transparent;
  border-color: transparent;
}

.connection-card[data-status="offline"],
.connection-card[data-status="empty"] {
  background: transparent;
  border-color: transparent;
}

.connection-card strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.connection-card div span {
  display: none;
}

.connection-dot {
  background: var(--yellow);
  border-radius: 50%;
  flex: 0 0 auto;
  height: 8px;
  width: 8px;
}

.connection-card[data-status="connected"] .connection-dot {
  background: var(--green);
}

.connection-card[data-status="empty"] .connection-dot,
.connection-card[data-status="offline"] .connection-dot {
  background: var(--red);
}

.connect-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--primary);
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 14px;
}

.connect-button:hover {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.2);
}

.connect-button.secondary {
  background: transparent;
  color: var(--primary);
}

.connect-button.secondary:hover {
  background: var(--surface-muted);
  color: var(--primary);
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.profile-menu {
  position: relative;
}

.profile-header-name {
  color: #3c4043;
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  max-width: 156px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  height: 40px;
  justify-content: flex-end;
  max-width: 220px;
  min-height: 40px;
  padding: 2px 2px 2px 10px;
  width: auto;
}

.profile-button:hover,
.profile-button[aria-expanded="true"] {
  background: var(--surface-muted);
}

.profile-avatar {
  align-items: center;
  background: var(--primary-soft);
  border-radius: 50%;
  color: var(--primary);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  line-height: 1;
  width: 32px;
}

.profile-button:hover .profile-avatar,
.profile-button[aria-expanded="true"] .profile-avatar {
  background: #d2e3fc;
}

.profile-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.16);
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 30;
}

.profile-menu-summary {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  margin-bottom: 4px;
  padding: 8px 8px 10px;
}

.profile-menu-summary strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.profile-menu-summary span {
  color: var(--muted);
  font-size: 12px;
}

.profile-menu-item {
  align-items: center;
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  font-size: 14px;
  font-weight: 650;
  min-height: 40px;
  padding: 9px 10px;
  text-decoration: none;
}

.profile-menu-item:hover {
  background: var(--surface-muted);
}

.logout-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 7px 10px;
}

.logout-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.header-center {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  min-width: 0;
}

.header-nav {
  align-items: center;
  display: flex;
  gap: 20px;
  min-height: 64px;
}

.header-nav-link {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 14px;
  font-weight: 650;
  min-height: 64px;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

.header-nav-link:hover {
  color: var(--ink);
}

.header-nav-link.active {
  color: var(--primary);
}

.header-nav-link.active::after {
  background: var(--primary);
  border-radius: 999px 999px 0 0;
  bottom: 0;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
}

.athlete-list {
  display: flex;
  gap: 4px;
  justify-content: flex-start;
  min-width: 0;
  overflow-x: auto;
  padding: 1px;
  scrollbar-width: thin;
}

.athlete-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  flex: 0 0 auto;
  min-width: 0;
  padding: 7px 9px;
  text-align: center;
}

.athlete-item:hover {
  background: var(--surface-muted);
}

.athlete-item.active {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.18);
}

.athlete-item strong,
.athlete-item span {
  display: block;
  overflow-wrap: anywhere;
}

.athlete-item strong {
  font-size: 13px;
  font-weight: 700;
}

.athlete-item span {
  display: none;
}

.main {
  display: grid;
  gap: 12px;
  margin: 0 auto;
  max-width: 1160px;
  padding: 28px 24px 48px;
}

.topbar,
.section-heading,
summary {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.topbar {
  padding: 6px 0 8px;
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.meta-line {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.meta-line span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 28px;
  padding: 5px 8px;
}

.top-actions {
  align-items: end;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: flex-end;
}

#refreshButton {
  background: transparent;
  border: 1px solid transparent;
  color: var(--primary);
  min-height: 36px;
  padding: 7px 10px;
}

#refreshButton:hover {
  background: transparent;
  color: #174ea6;
  text-decoration: underline;
}

.coach-panel,
.hero-grid,
.stat-strip,
.dashboard-grid,
.settings-panel {
  display: grid;
  gap: 12px;
}

.coach-panel {
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.32fr);
}

.coach-main,
.coach-score,
.coach-actions,
.score-card,
.stat-strip article,
.panel,
.settings-panel,
.raw-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.04);
}

.coach-main {
  display: grid;
  gap: 12px;
  min-height: 176px;
  padding: 22px;
}

.coach-main h2 {
  font-size: 26px;
  line-height: 1.18;
}

.coach-main p {
  color: #3c4043;
  line-height: 1.55;
}

.decision-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-row > span:last-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.decision-badge,
.alert-chip,
#payloadMode,
#mcpStatus,
.tool-list span {
  border-radius: var(--radius);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.decision-badge {
  background: var(--surface-muted);
  color: var(--muted);
  min-height: 28px;
  padding: 7px 10px;
  text-transform: uppercase;
}

.decision-badge[data-level="push"] {
  background: var(--green-soft);
  color: #137333;
}

.decision-badge[data-level="maintain"] {
  background: var(--yellow-soft);
  color: #8c5f00;
}

.decision-badge[data-level="recover"] {
  background: var(--red-soft);
  color: #a50e0e;
}

.alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-chip {
  background: var(--surface-muted);
  color: #3c4043;
  padding: 7px 9px;
}

.coach-score {
  align-content: center;
  display: grid;
  gap: 7px;
  padding: 18px 16px;
}

.coach-score strong {
  font-size: 40px;
  line-height: 1;
}

.coach-score p {
  color: var(--muted);
  line-height: 1.4;
}

.coach-actions {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
}

.coach-actions div {
  border-left: 1px solid var(--line);
  border-top: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.coach-actions div:first-child {
  border-left: 0;
}

.coach-actions span,
.stat-strip span,
dt,
.stage-grid span,
.setting-block > span,
.mcp-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.coach-actions strong {
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hero-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.score-card {
  align-content: space-between;
  display: grid;
  gap: 12px;
  min-height: 138px;
  padding: 16px;
}

.score-card strong {
  display: block;
  font-size: 34px;
  font-weight: 720;
  line-height: 1;
  margin-top: 6px;
}

.score-card p {
  color: var(--muted);
  line-height: 1.4;
}

.recovery-card {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 86px;
}

.score-ring {
  --score: 0;
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(var(--green) calc(var(--score) * 1%), #edf1f5 0);
  border-radius: 50%;
  color: #137333;
  display: grid;
  font-weight: 800;
  height: 86px;
  place-items: center;
  width: 86px;
}

.score-ring[data-level="medium"] {
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(var(--yellow) calc(var(--score) * 1%), #edf1f5 0);
  color: #8c5f00;
}

.score-ring[data-level="low"] {
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(var(--red) calc(var(--score) * 1%), #edf1f5 0);
  color: #a50e0e;
}

.stat-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-strip article {
  padding: 13px 14px;
}

.stat-strip strong,
dd,
.stage-grid strong {
  display: block;
  font-size: 20px;
  font-weight: 720;
  line-height: 1.2;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.settings-panel {
  align-items: end;
  background: #fbfcfe;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(220px, 1.05fr) auto;
  padding: 18px;
}

.setting-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.native-control {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.choice-group {
  background: #eef2f7;
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
}

.choice-chip {
  background: transparent;
  color: #3c4043;
  flex: 1 1 auto;
  font-size: 13px;
  min-height: 32px;
  min-width: 68px;
  padding: 6px 9px;
}

.choice-chip:hover {
  background: rgba(255, 255, 255, 0.82);
}

.choice-chip.selected {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
}

.settings-panel input {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

.date-picker {
  display: grid;
  gap: 6px;
  min-width: 254px;
  position: relative;
}

.date-picker > span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.date-picker-control {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 3px;
  grid-template-columns: 34px minmax(150px, 1fr) 34px;
  padding: 3px;
  position: relative;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.04);
}

.date-picker-control:hover,
.date-picker-control:focus-within {
  border-color: #c6c9cf;
}

.date-nav-button,
.date-main-button {
  background: transparent;
  color: #3c4043;
  min-height: 38px;
  padding: 6px 8px;
}

.date-nav-button {
  font-size: 22px;
  line-height: 1;
}

.date-main-button {
  align-content: center;
  cursor: pointer;
  display: grid;
  gap: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-main-button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.date-nav-button:hover,
.date-main-button:hover,
.date-main-button:focus-visible {
  background: var(--surface-muted);
  color: var(--primary);
}

.date-nav-button:disabled,
.date-main-button.disabled {
  background: transparent;
  color: var(--subtle);
  opacity: 0.55;
}

.native-date-input {
  appearance: auto;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  height: auto;
  min-width: 0;
  opacity: 1;
  padding: 0;
  pointer-events: auto;
  position: static;
  width: 100%;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

.skeleton-line,
.skeleton-bar,
.stage.skeleton-stage,
.app-shell[data-loading="true"] .score-ring {
  background:
    linear-gradient(90deg, #eef2f7 0%, #f8fafc 44%, #eef2f7 88%);
  background-size: 240% 100%;
  animation: skeleton-shimmer 1.15s ease-in-out infinite;
}

.skeleton-line {
  border-radius: 999px;
  display: block;
  height: 14px;
  max-width: 100%;
  width: 100%;
}

.skeleton-title {
  border-radius: var(--radius);
  height: 36px;
  max-width: 330px;
}

.skeleton-heading {
  border-radius: var(--radius);
  height: 31px;
  max-width: 520px;
}

.skeleton-copy {
  height: 16px;
  max-width: 92%;
}

.skeleton-meta {
  height: 14px;
  min-width: 94px;
}

.skeleton-pill {
  height: 14px;
  min-width: 76px;
}

.skeleton-chip {
  height: 30px;
  width: 116px;
}

.skeleton-score {
  border-radius: var(--radius);
  height: 42px;
  width: 82px;
}

.skeleton-short {
  height: 15px;
  max-width: 120px;
}

.skeleton-label {
  height: 11px;
  width: 64px;
}

.skeleton-value {
  height: 20px;
  max-width: 96px;
}

.app-shell[data-loading="true"] .score-ring {
  color: transparent;
}

.app-shell[data-loading="true"] .score-ring span {
  visibility: hidden;
}

.skeleton-metric {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.skeleton-trend .bars {
  background: #f8fafc;
}

.skeleton-bar {
  border-radius: 6px 6px 2px 2px;
  display: block;
  min-height: 8px;
}

.skeleton-axis {
  height: 12px;
  margin: 0 auto;
  width: 42px;
}

.stage.skeleton-stage {
  min-width: 18%;
}

.skeleton-row .skeleton-row-title {
  height: 15px;
  max-width: 190px;
}

.skeleton-row .skeleton-row-subtitle {
  height: 12px;
  margin-top: 8px;
  max-width: 150px;
}

.skeleton-mini-score {
  flex: 0 0 58px;
  height: 34px;
}

.settings-panel input:hover,
.settings-panel input:focus {
  background: var(--surface);
  border-color: rgba(26, 115, 232, 0.28);
}

#saveSettingsButton {
  background: var(--primary);
  color: #fff;
  min-width: 82px;
}

#saveSettingsButton:hover {
  background: #1765cc;
}

.baseline-pill {
  align-items: center;
  background: var(--green-soft);
  border-radius: var(--radius);
  color: #137333;
  display: flex;
  font-size: 13px;
  font-weight: 650;
  grid-column: 1 / -1;
  line-height: 1.35;
  padding: 10px 12px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
}

.developer-main {
  max-width: 900px;
}

.admin-main {
  max-width: 1160px;
}

.page-description {
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
  max-width: 620px;
}

.developer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.04);
  display: grid;
  gap: 18px;
  padding: 18px;
}

.admin-auth-panel {
  max-width: 560px;
}

.admin-key-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-login-link {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius);
  color: #fff;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  text-decoration: none;
  width: fit-content;
}

.admin-login-link:hover {
  background: #3c4043;
}

.admin-key-row input {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.admin-key-row input:hover,
.admin-key-row input:focus {
  border-color: var(--primary);
}

#adminUnlockButton {
  background: var(--primary);
  color: #fff;
  min-height: 44px;
  padding: 10px 18px;
}

#adminUnlockButton:hover {
  background: #174ea6;
}

#adminRefreshButton {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--primary);
  min-height: 36px;
  padding: 7px 12px;
}

#adminRefreshButton:hover {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.22);
}

.admin-stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.admin-stat-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 16px;
}

.admin-stat-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.admin-stat-grid strong {
  font-size: 24px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

.admin-table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table td {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.admin-table td strong,
.admin-table td span {
  display: block;
}

.admin-table td span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.status-pill {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex !important;
  font-size: 12px;
  font-weight: 760;
  margin-top: 0 !important;
  min-height: 24px;
  padding: 4px 9px;
  text-transform: capitalize;
}

.role-pill {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex !important;
  font-size: 12px;
  font-weight: 760;
  margin-top: 0 !important;
  min-height: 24px;
  padding: 4px 9px;
}

.role-pill[data-admin="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-pill[data-status="active"] {
  background: var(--green-soft);
  color: #137333;
}

.status-pill[data-status="expired"] {
  background: var(--red-soft);
  color: #a50e0e;
}

.advanced-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.04);
}

.advanced-section > summary {
  min-height: 48px;
}

.advanced-section[open] > summary {
  border-bottom: 1px solid var(--line);
}

.advanced-section > summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.advanced-section > summary strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
  text-align: right;
  text-transform: none;
}

.panel,
.raw-section {
  min-width: 0;
  padding: 18px;
}

.trend-panel {
  min-height: 310px;
}

.trend-chart {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  margin-top: 18px;
  min-height: 194px;
}

.trend-day {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.trend-day span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bars {
  align-items: end;
  background: var(--surface-muted);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
  height: 160px;
  padding: 7px;
}

.bar {
  border-radius: 6px 6px 2px 2px;
  display: block;
  min-height: 4px;
}

.bar.recovery,
.dot.recovery {
  background: var(--green);
}

.bar.sleep,
.dot.sleep {
  background: var(--primary);
}

.bar.strain,
.dot.strain {
  background: var(--violet);
}

.legend,
.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
}

.dot {
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.selected-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 14px;
}

.selected-day div {
  min-width: 0;
}

.selected-day .empty-row {
  grid-column: 1 / -1;
}

.selected-day span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.selected-day strong {
  display: block;
  font-size: 18px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.stage-bar {
  background: var(--surface-muted);
  border-radius: var(--radius);
  display: flex;
  height: 14px;
  margin-top: 18px;
  overflow: hidden;
}

.stage {
  min-width: 0;
}

.stage.awake {
  background: var(--yellow);
}

.stage.light {
  background: var(--primary);
}

.stage.deep {
  background: var(--violet);
}

.stage.rem {
  background: var(--teal);
}

.stage-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.stage-grid div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.workout-list,
.recovery-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.activity-row,
.recovery-row,
.empty-row {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.activity-row:first-child,
.recovery-row:first-child,
.empty-row:first-child {
  border-top: 0;
}

.activity-row {
  display: grid;
  gap: 10px;
}

.activity-row > div:first-child,
.recovery-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.activity-row strong,
.recovery-row strong {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.activity-row span,
.recovery-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 3px;
}

dl {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

dd {
  font-size: 15px;
}

.mini-score {
  background: var(--surface-muted);
  border-radius: var(--radius);
  color: var(--muted);
  flex: 0 0 58px;
  font-weight: 800;
  padding: 8px;
  text-align: center;
}

.recovery-row > div {
  min-width: 0;
}

.recovery-row[data-level="high"] .mini-score {
  background: var(--green-soft);
  color: #137333;
}

.recovery-row[data-level="medium"] .mini-score {
  background: var(--yellow-soft);
  color: #8c5f00;
}

.recovery-row[data-level="low"] .mini-score {
  background: var(--red-soft);
  color: #a50e0e;
}

.empty-row {
  color: var(--muted);
  line-height: 1.4;
}

.mcp-panel {
  background: transparent;
  border: 0;
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

#mcpStatus {
  background: var(--surface-muted);
  color: var(--muted);
  padding: 7px 9px;
}

#mcpStatus[data-status="enabled"] {
  background: var(--green-soft);
  color: #137333;
}

.mcp-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mcp-grid div {
  background: var(--surface-muted);
  border-radius: var(--radius);
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
}

.mcp-token-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
}

#generateMcpTokenButton {
  background: var(--ink);
  color: #fff;
}

#generateMcpTokenButton:hover {
  background: #3c4043;
}

#mcpTokenOutput {
  background: var(--surface-muted);
  border-radius: var(--radius);
  display: block;
  min-height: 40px;
  padding: 12px;
}

.mcp-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

code {
  color: #303134;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tool-list span {
  background: var(--surface-muted);
  color: #3c4043;
  padding: 7px 9px;
}

.raw-section {
  padding: 0;
}

summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
}

summary::-webkit-details-marker {
  display: none;
}

summary span {
  font-size: 16px;
  font-weight: 700;
}

#payloadMode {
  background: var(--surface-muted);
  color: var(--muted);
  padding: 7px 9px;
}

pre {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  color: #303134;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

@media (max-width: 1120px) {
  .app-header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .header-actions {
    grid-column: auto;
  }

  .header-center {
    justify-content: center;
  }

  .coach-panel,
  .hero-grid,
  .dashboard-grid,
  .settings-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coach-main,
  .recovery-card,
  .trend-panel,
  .note-field {
    grid-column: 1 / -1;
  }

  .stat-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mcp-grid {
    grid-template-columns: 1fr;
  }

  .mcp-token-row {
    grid-template-columns: 1fr;
  }

  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-day {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header-inner {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: auto;
    padding: 12px;
    position: static;
    row-gap: 0;
  }

  .brand {
    min-height: 40px;
  }

  .header-actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .profile-header-name {
    max-width: 112px;
  }

  .header-center {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-center::-webkit-scrollbar {
    display: none;
  }

  .header-nav {
    gap: 18px;
    min-height: 44px;
  }

  .header-nav-link {
    min-height: 44px;
  }

  .connection-card {
    align-items: center;
    flex: 0 1 auto;
    flex-direction: row;
    grid-column: auto;
    justify-content: space-between;
    width: auto;
  }

  .connection-card strong {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .connection-card .connect-button {
    width: auto;
  }

  .logout-button {
    width: auto;
  }

  .connect-button {
    width: auto;
  }

  .athlete-list {
    flex-direction: row;
    overflow: visible;
  }

  .athlete-item {
    width: auto;
  }

  .main {
    gap: 14px;
    padding: 20px 12px 36px;
  }

  .topbar,
  .activity-row > div:first-child,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .top-actions button {
    width: 100%;
  }

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-key-row {
    grid-template-columns: 1fr;
  }

  .admin-key-row button,
  .admin-login-link,
  #adminRefreshButton {
    width: 100%;
  }

  .coach-panel,
  .dashboard-grid,
  .settings-panel,
  .stage-grid,
  .recovery-card {
    grid-template-columns: 1fr;
  }

  .hero-grid,
  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coach-main,
  .coach-score,
  .coach-actions,
  .score-card,
  .panel,
  .settings-panel {
    padding: 16px;
  }

  .coach-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coach-actions div:nth-child(n) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .coach-actions div:nth-child(2n) {
    border-left: 1px solid var(--line);
  }

  .coach-actions div:nth-child(-n + 2) {
    border-top: 0;
  }

  .choice-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-chip,
  .choice-group.compact .choice-chip {
    min-width: 0;
    white-space: normal;
  }

  #saveSettingsButton {
    width: 100%;
  }

  .trend-chart {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .trend-day {
    min-width: 50px;
  }

  .date-picker {
    width: 100%;
  }

  .date-picker-control {
    width: 100%;
  }

  .date-picker button {
    width: auto;
  }

  .selected-day {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recovery-row {
    align-items: flex-start;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .recovery-row > strong:last-child {
    grid-column: 2;
  }

  h1 {
    font-size: 28px;
  }

  .coach-main h2 {
    font-size: 22px;
  }

  .score-card strong {
    font-size: 34px;
  }

  dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  body {
    font-size: 14px;
  }

  .choice-group {
    grid-template-columns: 1fr;
  }

  .hero-grid,
  .coach-actions {
    grid-template-columns: 1fr;
  }

  .coach-actions div:nth-child(n) {
    border-left: 0;
  }

  .coach-actions div:first-child {
    border-top: 0;
  }

  .selected-day {
    grid-template-columns: 1fr;
  }

  .admin-stat-grid {
    grid-template-columns: 1fr;
  }

  .meta-line span {
    width: 100%;
  }

  .profile-header-name {
    display: none;
  }

  .profile-button {
    height: 36px;
    min-height: 36px;
    padding: 2px;
    width: 36px;
  }

  .coach-main,
  .coach-score,
  .coach-actions,
  .score-card,
  .panel,
  .settings-panel {
    padding: 14px;
  }

  .stat-strip article {
    padding: 12px;
  }

  h1 {
    font-size: 26px;
  }

  .coach-main h2 {
    font-size: 20px;
  }

  .score-card strong {
    font-size: 31px;
  }
}
