:root {
  --bg: #f6f7f9;
  --text: #20252d;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --accent: #186f65;
  --accent-strong: #0f4f49;
  --danger: #b42318;
  --warning: #9a6700;
  --soft: #e9f3f1;
  --shadow: 0 18px 42px rgba(25, 32, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
}

button {
  min-height: 42px;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

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

button.secondary {
  background: white;
  color: var(--accent-strong);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.button-link.secondary {
  background: white;
  color: var(--accent-strong);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  background: white;
  color: var(--text);
}

textarea {
  resize: vertical;
}

main {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  margin: 0 auto;
}

.auth-panel {
  width: min(480px, 100%);
}

.auth-panel h1 {
  margin: 0 0 22px;
  font-size: 2.2rem;
}

.single-column {
  grid-template-columns: 1fr;
}

.switch-link {
  margin: 18px 0 0;
  color: var(--muted);
}

.switch-link a {
  color: var(--accent-strong);
  font-weight: 800;
}

.auth-footer-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.auth-footer-links a {
  color: var(--accent-strong);
  font-weight: 800;
}

.auth-footer-links .admin-link {
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.auth-footer-links .admin-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.admin-password-form {
  max-width: 520px;
}

.about-header {
  align-items: center;
}

.header-subtitle {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.about-page {
  margin-bottom: 64px;
}

.about-intro {
  display: grid;
  gap: 10px;
  font-size: 1.05rem;
}

.about-intro p,
.about-card p {
  margin: 0;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.about-card {
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 0;
}

.about-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.about-card h3 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 1rem;
}

.about-card ul {
  margin: 0;
  padding-left: 20px;
}

.about-card li {
  margin: 4px 0;
}

.about-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.about-final {
  grid-column: 1 / -1;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: min(1200px, calc(100% - 32px));
  margin: 32px auto 18px;
}

.app-header h1,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.98;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.active-athlete {
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.active-athlete span,
.muted,
.athlete-card small,
.list-toolbar span,
.result-card span {
  color: var(--muted);
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto 18px;
  padding: 10px 0;
  overflow-x: auto;
  background: rgba(246, 247, 249, 0.94);
  backdrop-filter: blur(10px);
}

.section-nav a,
.pill,
.status {
  white-space: nowrap;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
  text-decoration: none;
}

.section-nav a {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.section-nav a.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.panel {
  margin: 18px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading,
.list-toolbar,
.compact-controls,
.header-actions,
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 20px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.filters {
  align-items: end;
  justify-content: start;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filters label {
  min-width: min(260px, 100%);
}

.filters button {
  min-width: 120px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 700;
}

.wide,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions button {
  min-width: 160px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
}

.athlete-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.athlete-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.athlete-card.active {
  border-color: var(--accent);
  background: var(--soft);
}

.athlete-card .card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.athlete-card button,
.athlete-card .button-link {
  min-height: 36px;
  padding: 6px 10px;
}

.athlete-card form {
  margin: 0;
}

.dashboard-list {
  gap: 12px;
}

.danger-button {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.compact-pill {
  display: inline-flex;
  padding: 5px 9px;
  font-size: 0.78rem;
}

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

.row-actions form {
  margin: 0;
}

.row-actions a {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.admin-table table {
  min-width: 980px;
}

.admin-table td {
  vertical-align: top;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 800;
}

.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 800;
}

.flash.success {
  border-color: #a9d8c8;
  background: #edf8f3;
  color: var(--accent-strong);
}

.flash.error {
  border-color: #fecdca;
  background: #fff1f0;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.notice {
  padding: 12px;
  border: 1px solid #f2d58a;
  border-radius: 6px;
  background: #fff8e6;
  color: var(--warning);
  font-weight: 700;
}

.pill,
.status {
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.status.invalid {
  background: #fff1f0;
  color: var(--danger);
}

.warmup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.warmup-grid h3 {
  margin: 0 0 6px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  font-weight: 600;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.result-band {
  background: #10201f;
  color: white;
}

.result-band .eyebrow,
.result-band .muted {
  color: #9bd6cc;
}

.result-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.result-card {
  min-height: 92px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.result-grid.light .result-card {
  border-color: var(--line);
  background: #fbfcfe;
  color: var(--text);
}

.metric-grid .metric {
  border-color: var(--line);
  background: #fbfcfe;
}

.metric span,
.result-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.result-card span {
  color: #b7d6d1;
}

.metric strong,
.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

td button {
  min-height: 34px;
  padding: 5px 9px;
}

.best-line {
  margin: -6px 0 14px;
  color: var(--accent-strong);
  font-weight: 800;
}

.compact-controls {
  flex-wrap: wrap;
}

.compact-controls select,
#progressExercise {
  min-width: 190px;
}

.chart-wrap {
  height: 320px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

#progressChart {
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .app-header,
  .two-column,
  .warmup-grid,
  .about-grid,
  .about-lists {
    grid-template-columns: 1fr;
  }

  .athlete-card {
    align-items: stretch;
    flex-direction: column;
  }

  .athlete-card .card-actions {
    justify-content: flex-start;
  }

  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header {
    display: grid;
    align-items: stretch;
  }

  .test-grid,
  .result-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  main,
  .app-header,
  .section-nav {
    width: min(100% - 20px, 1200px);
  }

  .panel {
    padding: 16px;
  }

  .form-grid,
  .test-grid,
  .result-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
  }
}
