:root {
  --white: #ffffff;
  --primary: #d8222a;
  --navy: #043674;
  --blue: #074390;
  --sky: #0178ac;
  --teal: #06a955;
  --green: #6ebf4d;
  --yellow: #dfa90e;
  --rose: #cc7a83;
  --charcoal: #1a1918;
  --gray: #9e9f9e;
  --border: #e1e4eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #ffffff;
  color: var(--charcoal);
  padding-top: 56px;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 3px solid rgba(0, 0, 0, 0.1);
  color: var(--charcoal);
}

.hero {
  align-items: stretch;
  margin-bottom: 12px;
}

.hero-text {
  flex: 1;
}

.hero-actions {
  margin-top: 12px;
}

.list-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

.list-controls .list-search {
  flex: 1;
  min-width: 200px;
}

.auto-width-select {
  width: max-content;
  min-width: 220px;
  max-width: 100%;
  display: inline-block;
  white-space: nowrap;
  align-self: flex-start;
  flex: 0 1 auto;
}

.auto-width-select option {
  white-space: nowrap;
}

.pill-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  background: rgba(4, 54, 116, 0.06);
  border-radius: 999px;
}

.pill-switch .pill-option {
  border: 1px solid rgba(4, 54, 116, 0.35);
  background: #ffffff;
  color: var(--navy);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.pill-switch .pill-option.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: 0 6px 18px rgba(4, 54, 116, 0.25);
}

.sort-switch {
  background: rgba(6, 169, 85, 0.08);
  border: 1px solid rgba(6, 169, 85, 0.2);
}

.sort-switch .pill-option {
  border-color: rgba(6, 169, 85, 0.5);
  color: var(--teal);
}

.sort-switch .pill-option.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

header h1 {
  font-size: 2.8rem;
  margin: 0;
}

header .lede {
  max-width: 640px;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.language-switcher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 140px;
}

.language-switcher label {
  font-size: 0.85rem;
  color: var(--gray);
}

.language-switcher select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7f9fc;
  font-weight: 600;
  color: var(--charcoal);
}

.language-floating {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 80;
}

@media (max-width: 720px) {
  header {
    flex-direction: column;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .language-switcher {
    align-items: flex-start;
  }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  margin: 0 0 8px;
  color: var(--yellow);
}

section {
  background: var(--white);
  padding: 32px;
  border-radius: 16px;
  margin-top: 32px;
  border-top: 6px solid rgba(4, 54, 116, 0.7);
  box-shadow: 0 10px 30px rgba(4, 54, 116, 0.1);
}

section:nth-of-type(2n) {
  border-top-color: rgba(216, 34, 42, 0.65);
}

section:nth-of-type(3n) {
  border-top-color: rgba(6, 169, 85, 0.65);
}

#units-section {
  border-top-color: var(--yellow);
}

#completion-section {
  border-top-color: var(--teal);
  text-align: center;
}

#completion-section .completion-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#completion-section .completion-hint {
  margin: 0;
  color: var(--gray);
  max-width: 520px;
}

#completion-section .finish-btn {
  font-size: 1.1rem;
  padding: 16px 32px;
  min-width: 260px;
}

#completion-section .finish-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#units-section h2 {
  color: var(--yellow);
}

#units-section .hint {
  color: rgba(223, 169, 14, 0.9);
}

.available-units {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(4, 54, 116, 0.25);
  border-radius: 8px;
  background: rgba(4, 54, 116, 0.04);
}

.available-units[hidden] {
  display: none;
}

.available-units h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--yellow);
  width: 100%;
}

.available-unit-header h3 {
  margin: 0;
  width: auto;
  flex: 1 1 auto;
}

.available-unit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.available-unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.available-unit-card {
  border: 1px solid rgba(4, 54, 116, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  width: clamp(300px, 32vw, 400px);
  min-width: 300px;
  max-width: 400px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  row-gap: 4px;
  column-gap: 8px;
  align-items: center;
  flex: 0 1 auto;
}

.available-unit-card strong {
  font-size: 0.95rem;
  color: var(--navy);
}

.available-unit-card strong,
.available-unit-card .unit-meta:first-of-type {
  grid-column: 1 / span 2;
}

.available-unit-card .unit-athletes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.78rem;
  grid-column: 1 / span 2;
}

.available-unit-card .unit-athletes span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(67, 118, 150, 0.15);
  color: var(--navy);
}

.available-unit-card .unit-meta {
  font-size: 0.76rem;
  color: var(--gray);
}

.available-unit-card .unit-warning {
  grid-column: 1 / span 2;
  color: var(--primary);
  font-size: 0.8rem;
  margin: 2px 0 0;
}

.available-unit-card .unit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.available-unit-card .unit-actions .btn {
  font-size: 0.85rem;
  padding: 6px 14px;
}

.available-unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.unit-actions-row {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 12px;
}

#unit-list {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed rgba(4, 54, 116, 0.25);
  border-radius: 8px;
  background: rgba(4, 54, 116, 0.02);
}

#unit-list h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--yellow);
  width: 100%;
}

.reported-unit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reported-unit-card {
  border: 1px solid rgba(4, 54, 116, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  width: clamp(300px, 32vw, 400px);
  min-width: 300px;
  max-width: 400px;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.reported-unit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.reported-unit-card h4 {
  margin: 0;
  color: var(--navy);
}

.reported-unit-card small {
  color: var(--gray);
}

.reported-unit-card .unit-athletes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.78rem;
}

.reported-unit-card .unit-athletes span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(67, 118, 150, 0.12);
  color: var(--navy);
}

.reported-unit-card .remove-btn {
  align-self: flex-end;
  font-size: 0.95rem;
  padding: 0;
  width: 32px;
  height: 32px;
}

.reported-unit-card .remove-btn.confirming {
  background: var(--yellow);
  color: #ffffff;
}

.unit-empty {
  margin: 0;
  color: var(--gray);
}

h2 {
  margin-top: 0;
  color: var(--navy);
}

h3 {
  margin-top: 0;
  color: var(--blue);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--gray);
}

.field input,
.field textarea,
.field select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216, 34, 42, 0.1);
}

.list-search {
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 4px;
  font-size: 1rem;
  font-family: inherit;
  background: transparent;
  margin: 8px 0 12px;
}

.field .list-search {
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
}

.list-search:focus {
  outline: none;
  border-bottom-color: var(--primary);
  box-shadow: none;
}

.field.field-full {
  grid-column: 1 / -1;
}

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

.form-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-actions .spacer {
  flex: 1;
}

.form-actions .btn {
  width: fit-content;
}

.unit-submit {
  margin-left: auto;
}

.club-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 320px);
  gap: 32px;
  align-items: start;
}

.club-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.club-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 320px);
  gap: 32px;
  align-items: start;
}

.contact-left,
.contact-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.logo-preview {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  background: rgba(1, 120, 172, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.logo-preview.drag-over {
  border-color: var(--sky);
  background: rgba(1, 120, 172, 0.12);
}

.logo-preview img {
  max-height: 150px;
  max-width: 100%;
  object-fit: contain;
}

.drop-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--gray);
}

.notice {
  background: #fff9e6;
  border: 1px solid rgba(223, 169, 14, 0.4);
  border-radius: 16px;
  padding: 32px;
  margin-top: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  color: var(--white);
}

.btn.primary {
  background: var(--primary);
}

.btn.accent {
  background: var(--blue);
}

.btn.danger {
  background: var(--primary);
}

.btn.secondary {
  background: var(--sky);
}

.btn.success {
  background: var(--green);
  color: #ffffff;
}

.btn.warning {
  background: var(--yellow);
  color: #ffffff;
}

.btn.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.btn.icon-button.unregister {
  background: var(--yellow);
  color: #ffffff;
}

.btn.icon-button.delete {
  background: var(--primary);
  color: #ffffff;
}

.btn.icon-button.register {
  background: var(--green);
  color: #ffffff;
}

.btn.icon-button.edit {
  background: var(--sky);
  color: #ffffff;
}

.pill-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.btn.icon-button:disabled {
  background: rgba(4, 54, 116, 0.1);
  color: var(--gray);
  border: 1px solid rgba(4, 54, 116, 0.2);
  cursor: not-allowed;
}

.btn.icon-button.confirming {
  width: auto;
  height: auto;
  padding: 6px 12px;
  border-radius: 12px;
}

.required-star {
  color: var(--primary);
  font-weight: 600;
}

.read-only-field {
  background: rgba(1, 24, 38, 0.05);
  color: var(--gray);
  cursor: not-allowed;
}

.is-disabled {
  opacity: 0.6;
  pointer-events: none !important;
}

.athlete-pill.is-disabled,
.athlete-list-item.is-disabled {
  cursor: default;
}

.logo-preview.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.notification-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.notification-toast {
  min-width: 220px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(4, 54, 116, 0.95);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 10px 25px rgba(4, 54, 116, 0.25);
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.notification-toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.notification-toast.info {
  background: rgba(4, 54, 116, 0.95);
}

.notification-toast.success {
  background: rgba(6, 169, 85, 0.95);
}

.notification-toast.error {
  background: rgba(216, 34, 42, 0.95);
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

section #athlete-list {
  margin-top: 16px;
}

section #judge-list {
  margin-top: 16px;
}

#athlete-list.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#judge-list.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#unit-list.card-list {
  display: block;
}

#judge-list {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed rgba(26, 25, 24, 0.3);
  border-radius: 8px;
  background: rgba(26, 25, 24, 0.03);
}

.athlete-button-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.judge-button-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.athlete-list-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.athlete-list-item:hover {
  border-color: var(--sky);
  transform: translateY(-1px);
}

.athlete-list-item .pill-actions,
.judge-list-item .pill-actions {
  margin-left: auto;
}
.judge-pill .pill-actions {
  margin-left: auto;
}

.judge-list-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--charcoal);
  border-radius: 999px;
  background: #ffffff;
  color: var(--charcoal);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  max-width: 420px;
  width: fit-content;
  gap: 12px;
}

.judge-list-item:hover {
  border-color: rgba(0, 0, 0, 0.7);
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.athlete-list-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.judge-list-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.athlete-list-meta {
  color: var(--gray);
  font-size: 0.9rem;
}

.judge-list-meta {
  color: var(--gray);
  font-size: 0.9rem;
}

.judge-list-item .judge-actions {
  margin-left: auto;
  display: inline-flex;
}

.athlete-empty {
  margin: 0;
  color: var(--gray);
}

.judge-empty {
  margin: 0;
  color: var(--gray);
}

.athlete-add-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px dashed var(--sky);
  background: rgba(1, 120, 172, 0.08);
  color: var(--sky);
  font-weight: 600;
  cursor: pointer;
}

.judge-add-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px dashed var(--charcoal);
  background: rgba(0, 0, 0, 0.05);
  color: var(--charcoal);
  font-weight: 700;
  cursor: pointer;
}

.athlete-add-pill .plus {
  font-size: 1.2rem;
}

.judge-add-pill .plus {
  font-size: 1.2rem;
}

.unit-add-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px dashed var(--yellow);
  background: rgba(223, 169, 14, 0.16);
  color: var(--charcoal);
  font-weight: 700;
  cursor: pointer;
}

.unit-add-pill .plus {
  font-size: 1.2rem;
  color: var(--yellow);
}

.unit-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 0;
}

.pill-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.pill-select.grouped {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid rgba(4, 54, 116, 0.35);
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
}

.pill-select.grouped .athlete-pill {
  min-width: max-content;
  flex: 1 1 auto;
  border-radius: 0;
  border: 1px solid rgba(4, 54, 116, 0.2);
  margin: -1px 0 0 -1px;
  justify-content: center;
  padding: 10px 10px 12px;
  color: var(--charcoal);
  background: #ffffff;
  transition: background 0.2s ease, color 0.2s ease;
  text-align: center;
  flex-direction: column;
  gap: 4px;
}

.pill-select.grouped .athlete-pill,
.pill-select.grouped .competition-pill {
  min-width: max-content;
}

.pill-select.grouped .athlete-pill .pill-checkbox {
  display: none;
}

.pill-select.grouped .athlete-pill.selected {
  background: var(--yellow);
  color: #ffffff;
  border-color: var(--yellow);
}

.pill-select.grouped .athlete-pill.selected .pill-label,
.pill-select.grouped .athlete-pill.selected .pill-sub-label {
  color: #ffffff;
}

.pill-select.grouped .competition-pill {
  min-width: max-content;
  flex: 1 1 auto;
  border-radius: 0;
  border: 1px solid rgba(4, 54, 116, 0.25);
  margin: -1px 0 0 -1px;
  justify-content: center;
  padding: 10px 10px 12px;
  color: var(--charcoal);
  background: #ffffff;
  transition: background 0.2s ease, color 0.2s ease;
  text-align: center;
  flex-direction: column;
  gap: 4px;
}

.pill-select.grouped .competition-pill .pill-checkbox {
  display: none;
}

.pill-select.grouped .competition-pill.selected {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

.pill-select.grouped .competition-pill.selected .pill-label,
.pill-select.grouped .competition-pill.selected .pill-sub-label {
  color: #ffffff;
}

.pill-select.grouped .pill-label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  font-weight: 600;
}

.pill-select.grouped .pill-sub-label {
  font-size: 0.8rem;
  color: var(--gray);
  display: block;
}

.pill-sub-label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray);
  text-align: center;
  line-height: 1.1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fdfdfd;
}

.card h4 {
  margin: 0;
  color: var(--blue);
}

.card small {
  color: var(--gray);
}

.unit-athletes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.unit-athletes span {
  background: rgba(1, 120, 172, 0.12);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: var(--blue);
}

.card .remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.card .remove-btn.confirming,
.btn.confirming {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
}

.unit-form {
  margin-top: 0;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.hint {
  color: var(--gray);
}

.athlete-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.athlete-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--gray);
  background: #ffffff;
  color: var(--gray);
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.athlete-pill .pill-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--gray);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.athlete-pill.selected {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.athlete-pill.selected .pill-checkbox {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
  color: #ffffff;
}

.athlete-pill .pill-label {
  white-space: normal;
  text-align: left;
}

.available-judges {
  margin-top: 8px;
  padding: 12px;
  border: 1px dashed rgba(26, 25, 24, 0.3);
  border-radius: 8px;
  background: rgba(26, 25, 24, 0.02);
}

.available-judge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.available-judge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.judge-pill {
  border: 1px dashed rgba(26, 25, 24, 0.4);
  border-radius: 999px;
  padding: 10px 14px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: 520px;
  min-width: 260px;
}

.judge-pill.registered {
  border-style: solid;
}

.available-judge-card strong {
  color: var(--charcoal);
}

.judge-meta {
  color: var(--gray);
  margin: 0;
}

.judge-actions {
  display: flex;
  justify-content: flex-end;
}

.btn.icon-button.judge-add {
  background: var(--charcoal);
  color: #ffffff;
  border: 1px solid var(--charcoal);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 24, 0.45);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  width: min(640px, calc(100% - 40px));
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  z-index: 51;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.wide-modal {
  width: min(920px, calc(100% - 32px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding-bottom: 8px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray);
}

.modal-form .form-grid {
  margin-top: 0;
}

.modal-form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(4, 54, 116, 0.4) rgba(4, 54, 116, 0.1);
}
.modal-form::before,
.modal-form::after {
  content: '';
  position: sticky;
  left: 0;
  right: 0;
  height: 18px;
  pointer-events: none;
  display: block;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-form::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent);
}
.modal-form::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
}
.modal-form.fade-top::before {
  opacity: 1;
}
.modal-form.fade-bottom::after {
  opacity: 1;
}
.modal-form::-webkit-scrollbar { width: 8px; }
.modal-form::-webkit-scrollbar-thumb { background: rgba(4, 54, 116, 0.35); border-radius: 999px; }
.modal-form::-webkit-scrollbar-track { background: rgba(4, 54, 116, 0.05); }

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding-top: 12px;
}

.modal-actions .spacer {
  flex: 1;
}

body.modal-open {
  overflow: hidden;
}

.completion-summary-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(4, 54, 116, 0.4) rgba(4, 54, 116, 0.1);
  margin-bottom: 12px;
}
.completion-summary-body::before,
.completion-summary-body::after {
  content: '';
  position: sticky;
  left: 0;
  right: 0;
  height: 18px;
  pointer-events: none;
  display: block;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.completion-summary-body::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent);
}
.completion-summary-body::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
}
.completion-summary-body.fade-top::before {
  opacity: 1;
}
.completion-summary-body.fade-bottom::after {
  opacity: 1;
}
.completion-summary-body::-webkit-scrollbar { width: 8px; }
.completion-summary-body::-webkit-scrollbar-thumb { background: rgba(4, 54, 116, 0.35); border-radius: 999px; }
.completion-summary-body::-webkit-scrollbar-track { background: rgba(4, 54, 116, 0.05); }

.summary-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  background: #f9fbff;
}

.competition-list {
  margin-top: 12px;
}

.competition-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.competition-card {
  border: 1px solid rgba(4, 54, 116, 0.18);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.cta-card {
  border: 1px solid rgba(4, 54, 116, 0.12);
  border-radius: 14px;
  padding: 16px;
  background: #f9fbff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
  max-width: 420px;
}

.competition-landing {
  margin-top: 12px;
}
.competition-card h3 {
  margin: 0 0 8px;
}

.competition-card .comp-meta {
  margin: 0 0 6px;
  color: var(--gray);
}

.competition-card .comp-deadline {
  margin: 0 0 10px;
  color: var(--navy);
  font-weight: 600;
}

.competition-card .comp-actions {
  display: flex;
  justify-content: flex-end;
}

.summary-block h4 {
  margin: 0 0 8px;
  color: var(--navy);
}

.modal-dialog.scroll-hint-active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 75px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid rgba(4, 54, 116, 0.6);
  opacity: 0.8;
  animation: scroll-bounce 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes scroll-bounce {
  0%,
  60%,
  100% {
    transform: translate(-50%, 0);
  }
  30% {
    transform: translate(-50%, -6px);
  }
}

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

.summary-stats div {
  flex: 1 1 120px;
  text-align: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid rgba(4, 54, 116, 0.12);
}

.summary-stats span {
  display: block;
  font-size: 0.85rem;
  color: var(--gray);
}

.summary-stats strong {
  display: block;
  font-size: 1.4rem;
  color: var(--blue);
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(4, 54, 116, 0.12);
}

.summary-list li:last-child {
  border-bottom: none;
}

.summary-unit-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--navy);
  flex-wrap: wrap;
}

.summary-subline {
  color: var(--gray);
  font-size: 0.85rem;
}

.summary-empty {
  margin: 0;
  font-style: italic;
  color: var(--gray);
}

.summary-deadline,
.summary-note {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--charcoal);
}

.summary-note {
  color: var(--gray);
}

.summary-thanks {
  margin: 8px 0 0;
  text-align: center;
  font-weight: 600;
  color: var(--teal);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.btn.ghost {
  background: transparent;
  color: var(--sky);
  border: 1px solid rgba(1, 120, 172, 0.3);
}

.btn.ghost.reset-btn {
  color: var(--gray);
  border-color: rgba(158, 159, 158, 0.5);
  background: rgba(158, 159, 158, 0.12);
}

.btn.ghost.danger {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

#sync-status {
  position: fixed;
  top: 0;
  right: 24px;
  transform: none;
  padding: 8px 18px;
  border-radius: 0 0 12px 12px;
  font-weight: 600;
  font-size: 0.8rem;
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

#sync-status .status-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

#sync-status .status-tag.hidden {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.35);
}

#sync-status .spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

#sync-status.status-missing {
  background: var(--primary);
}

#sync-status.status-saving {
  background: var(--yellow);
  color: var(--charcoal);
}

#sync-status.status-saved {
  background: var(--teal);
}

#sync-status.status-offline,
#sync-status.status-error {
  background: var(--rose);
}

#sync-status.status-locked {
  background: var(--navy);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
  }

  section {
    padding: 24px;
  }

  .club-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

  .form-actions .spacer {
    display: none;
  }

  .form-actions .btn {
    width: 100%;
    margin-left: 0;
  }
}
.club-start-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.club-start-row .club-name-field {
  flex: 1;
}

#club-start-btn {
  height: fit-content;
  margin-bottom: 4px;
}

.club-start-row.full-width .club-name-field {
  flex: unset;
  width: 100%;
}

.club-start-message {
  margin: 8px 0 16px;
  padding: 12px 16px;
  background: rgba(223, 169, 14, 0.15);
  border: 1px solid rgba(223, 169, 14, 0.4);
  border-radius: 12px;
  font-size: 0.9rem;
}

.club-start-message.info {
  background: rgba(6, 169, 85, 0.12);
  border-color: rgba(6, 169, 85, 0.4);
}

.club-start-message.error {
  background: rgba(216, 34, 42, 0.12);
  border-color: rgba(216, 34, 42, 0.4);
}

.club-start-message .actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.club-extra {
  transition: opacity 0.2s ease;
}

[data-locked='true'] {
  display: none !important;
}
