.athlete-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}

.athlete-list-empty {
  font-size: 0.82rem;
  color: var(--sidebar-muted);
  padding: 8px 4px;
}

.athlete-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sidebar-text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.athlete-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}

.athlete-item.is-active {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(96, 165, 250, 0.55);
}

.athlete-item-name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
}

.athlete-item-id {
  margin: 3px 0 0;
  font-size: 0.75rem;
  color: var(--sidebar-muted);
  word-break: break-all;
}

.athlete-item-meta {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--sidebar-muted);
}

.id-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.id-row .icon-btn {
  flex-shrink: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  background: linear-gradient(180deg, #121829 0%, #0c101a 100%);
  color: var(--sidebar-text);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--sidebar-muted);
}

.panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.field span {
  color: var(--sidebar-muted);
}

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

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
}

.sidebar input,
.sidebar select {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
}

.hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--sidebar-muted);
  line-height: 1.35;
}

.week-nav {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 4px;
  align-items: center;
}

.week-nav .icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
}

.week-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-inline: 0;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  box-sizing: border-box;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  cursor: pointer;
}

.week-range {
  margin: 8px 0 0;
  font-size: 0.82rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  border-radius: 12px;
  padding: 11px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--sidebar-text);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.sync-dot.busy {
  background: #f59e0b;
  animation: pulse 1s infinite alternate;
}

.sync-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 28%, transparent);
}

.sync-dot.error {
  background: var(--danger);
}

@keyframes pulse {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

.main {
  padding: 28px clamp(16px, 3vw, 40px) 40px;
}

.main-header {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.main-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
}

.muted {
  color: var(--muted);
}

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

.stat {
  min-width: 120px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.stat-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.stat-input {
  width: 100%;
  border: none;
  padding: 0;
  font-size: 1.35rem;
  font-weight: 700;
  background: transparent;
}

.week-comment {
  margin-bottom: 32px;
  max-width: 720px;
}

.week-comment--above-week {
  display: block;
  margin: 0 0 20px;
  max-width: none;
}

.week-comment--above-week span {
  display: block;
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.week-comment--above-week input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--ios-fill, color-mix(in srgb, var(--card) 88%, var(--bg)));
  color: var(--text);
  font-size: 0.92rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.week-comment--above-week input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.week-comment--above-week input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.week-grid-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.week-grid-head .ios-group-label {
  margin-bottom: 0;
}

.week-grid-columns-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.week-grid-columns-field select {
  min-width: 4.5rem;
  padding: 6px 32px 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--text);
  font-size: 0.82rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(var(--week-grid-columns, 2), minmax(0, 1fr));
  gap: 16px;
  max-width: none;
  align-items: stretch;
}

@media (max-width: 720px) {
  .week-grid {
    grid-template-columns: 1fr;
  }
}

.week-grid .day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 10px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: stretch;
  height: 100%;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  grid-template-columns: unset;
  grid-template-rows: unset;
  transform-origin: center center;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.day-card:hover {
  transform: scale(1.018);
  z-index: 2;
  border-color: color-mix(in srgb, var(--day-accent, #94a3b8) 35%, var(--border));
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.12),
    var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  .day-card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
  }

  .day-card:hover {
    transform: none;
  }
}

.day-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--day-accent, #94a3b8);
}

.week-grid .day-card-top-row {
  display: grid;
  grid-template-columns: minmax(76px, 92px) minmax(0, 1fr) minmax(2.75rem, 3.5rem);
  gap: 8px 10px;
  align-items: end;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.day-card-top-row > .day-head {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  margin-bottom: 0;
}

.day-card-fields-row {
  display: contents;
}

.day-card-fields-row > label:nth-child(1) {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
}

.day-card-fields-row > label:nth-child(2) {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  max-width: 3.5rem;
  justify-self: end;
}

.day-card-fields-row--type-only > label:nth-child(1) {
  grid-column: 2 / 4;
}

.day-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex-shrink: 0;
}

.day-head-text {
  min-width: 0;
}

.day-head .type-pill {
  display: none;
}

.week-grid .day-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.week-grid .day-card-body > label,
.week-grid .day-card-body > .day-constructor-row,
.week-grid .day-card-footer {
  grid-column: unset;
  grid-row: unset;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.week-grid .day-card-top-row .day-head {
  grid-column: 1;
  grid-row: 1;
}

.day-card-body > label:has(textarea) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.day-card-body > label:has(textarea) textarea {
  flex: 1 1 auto;
  min-height: 52px;
  max-height: none;
  overflow-y: auto;
  resize: none;
}

.day-card-body > .day-constructor-row {
  flex-shrink: 0;
  margin-top: -2px;
}

.day-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-top: -2px;
}

.day-card-footer:empty {
  display: none;
}

@media (max-width: 560px) {
  .day-card-top-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .day-card-top-row > .day-head {
    grid-column: 1;
    width: 100%;
  }

  .day-card-top-row .day-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }

  .day-head .type-pill {
    display: inline-flex;
  }

  .day-card-fields-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    grid-column: 1;
  }

  .day-card-fields-row > label:nth-child(1),
  .day-card-fields-row > label:nth-child(2),
  .day-card-fields-row--type-only > label:nth-child(1) {
    grid-column: auto;
    grid-row: auto;
  }
}

.day-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.day-date {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.day-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 0;
}

.day-card select,
.day-card input,
.day-card textarea {
  width: 100%;
}

.day-card textarea {
  line-height: 1.4;
  resize: none;
}

.day-card textarea.day-assignment-input {
  --assignment-visible-lines: 4;
  min-height: 0;
  max-height: calc(var(--assignment-visible-lines) * 1.4em + 14px);
  height: calc(var(--assignment-visible-lines) * 1.4em + 14px);
  overflow-y: auto;
  overflow-x: hidden;
  field-sizing: fixed;
}

.day-card.is-rest {
  opacity: 0.62;
  filter: saturate(0.42);
  background: color-mix(in srgb, var(--card) 78%, var(--bg));
  border-color: color-mix(in srgb, var(--border) 55%, transparent);
}

.day-card.is-rest:hover {
  opacity: 0.72;
  filter: saturate(0.55);
}

.day-card.is-rest::before {
  background: #94a3b8;
  opacity: 0.65;
}

