:root {
  font-family: system-ui, sans-serif;
  overflow-wrap: anywhere;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  min-height: 44px;
  max-width: 100%;
  border: 1px solid var(--control-border);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
}
button {
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  background: var(--surface-hover);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
textarea {
  resize: vertical;
  width: 100%;
}
a {
  color: var(--primary);
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 1.5rem;
}
.page-heading,
.dialog-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
h1 {
  font-size: 2rem;
  margin: 0.2rem 0;
}
h2 {
  font-size: 1.3rem;
}
h3 {
  font-size: 1.05rem;
}
.hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 1.2rem 0;
}
.tabs button {
  border: 0;
  border-radius: 0.5rem 0.5rem 0 0;
  background: transparent;
}
.tabs [aria-selected="true"] {
  background: var(--primary);
  color: white;
}
.filters,
.actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.8rem 0;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 12rem;
  min-width: 0;
}
.filters input,
.filters select {
  width: 100%;
  min-width: 0;
}
.actions {
  align-items: center;
}
.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.primary:hover {
  background: var(--primary-hover);
}
.danger {
  color: #a3322b;
  border-color: #bf837d;
}
.notice {
  padding: 1rem;
  border-radius: 0.65rem;
}
.warning {
  background: #fff3d8;
  border: 1px solid #d5aa50;
}
.error,
[data-error="true"] {
  color: #a12c29;
}
#training-status:not(:empty) {
  min-height: 1.5rem;
}
#training-status:empty {
  margin: 0;
}
.catalog-heading .hint {
  margin: 0;
}
.catalog-heading button {
  flex-shrink: 0;
}
.workout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}
.workout-card {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  min-width: 0;
}
.workout-card h3 {
  margin: 0.2rem 0 0.5rem;
}
.workout-card label,
.check,
.template-pick,
.candidate-pick {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.workout-card label {
  align-items: flex-start;
}
.workout-card .meta {
  color: var(--text-muted);
  font-size: 0.87rem;
}
.workout-card .card-open {
  padding: 0.25rem 0;
  border: none;
  background: none;
  color: var(--primary);
  text-align: left;
  min-height: 44px;
}
.template-picks {
  max-height: 33rem;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}
.template-pick,
.candidate-pick {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.template-pick span,
.candidate-pick span {
  min-width: 0;
  flex: 1;
}
.candidate-pick button {
  min-width: 44px;
}
.assignment-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
  gap: 1rem;
}
.assignment-layout > section {
  min-width: 0;
}
.assignment-step {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0.7rem;
  padding: 0.85rem;
  margin-bottom: 0.8rem;
}
.assignment-step h2 {
  margin: 0;
}
.assignment-step .check {
  margin-bottom: 0.7rem;
}
#assignment-warmup-options summary {
  min-height: 44px;
  padding: 0.6rem 0;
  cursor: pointer;
}
#assignment-selection {
  margin-bottom: 0;
}
.session-date {
  white-space: nowrap;
}
.table-scroll {
  max-width: 100%;
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.92rem;
}
th,
td {
  text-align: left;
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
}
thead {
  background: var(--surface-muted);
}
td small {
  display: block;
  color: var(--text-muted);
}
dialog {
  width: min(1060px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--control-border);
  border-radius: 0.9rem;
  padding: 1.25rem;
  overflow: auto;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1rem 5rem #132c4c40;
}
dialog::backdrop {
  background: #132c4c88;
}
dialog form {
  margin: 0;
}
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
fieldset > label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.8rem 0;
}
.workout-section {
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--page-bg);
  padding: 0.9rem;
  margin: 0.8rem 0;
}
.section-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.item-row {
  display: flex;
  align-items: start;
  gap: 0.4rem;
}
.item-row textarea {
  flex: 1;
  min-width: 0;
}
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}
.item-actions button {
  padding: 0.4rem;
  min-width: 44px;
}
.warmup-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.warmup-layout section {
  min-width: 0;
}
.warmup-layout section > label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.7rem 0;
}
.preview {
  padding: 0.8rem;
  background: var(--surface-hover);
  border-radius: 0.5rem;
  margin: 0.8rem 0;
}
.preview p {
  margin: 0.4rem 0;
}
.catalog-selection-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  font-variant-numeric: tabular-nums;
}
.catalog-selection-status > span {
  flex: 0 0 min(100%, 11rem);
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  main {
    padding: 1rem;
  }
  .assignment-layout,
  .warmup-layout {
    grid-template-columns: 1fr;
  }
  .assignment-layout {
    gap: 0;
  }
  .period label:first-child {
    flex-basis: 100%;
  }
  .period button {
    width: 100%;
  }
  .assignment-step table {
    min-width: 0;
  }
  .assignment-step th,
  .assignment-step td {
    padding: 0.45rem 0.35rem;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
  }
  .selection-heading span {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }
  .filters label {
    flex-basis: calc(50% - 1rem);
  }
  .actions > button {
    flex: 1 1 10rem;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading > button {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .dialog-heading {
    align-items: flex-start;
  }
  dialog {
    padding: 0.9rem;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }
  .item-row {
    flex-wrap: wrap;
  }
  .item-row textarea {
    flex-basis: 100%;
  }
  .section-heading {
    flex-wrap: wrap;
  }
  h1 {
    font-size: 1.65rem;
  }
}
@media (max-width: 420px) {
  .filters label {
    flex-basis: 100%;
  }
  .period label:not(:first-child) {
    flex-basis: calc(50% - 0.4rem);
  }
  .catalog-heading button {
    width: 100%;
  }
  .tabs button {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.4rem;
  }
}
