/* Competencia por equipos: solo estructura especifica.
   La apariencia reutiliza paneles, tablas, botones y menus globales. */

body.team-competition-mode .pair-competition-only,
body.pair-competition-mode .team-competition-only,
body:not(.team-competition-mode):not(.pair-competition-mode) .team-competition-only {
  display: none !important;
}

body.team-competition-mode #standings-grid {
  grid-template-columns: minmax(0, 1fr);
}

#team-competition-admin .admin-tools-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-admin-panel,
.team-general-panel,
.team-roster-card,
.team-matches-panel {
  min-width: 0;
}

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

.team-meta-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) minmax(0, 1fr);
}

.team-config-grid .form-group,
.team-form-grid .form-group,
.team-meta-grid .form-group {
  min-width: 0;
}

#team-names-input,
#team-categories-input {
  min-height: 142px;
  line-height: 1.55;
  resize: vertical;
}

.team-field-help,
.team-scoring-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.team-pair-form,
.team-result-score {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--wire);
}

.team-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  margin-top: 14px;
}

.team-action-row .btn {
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

.team-shortcut-actions,
.team-match-side {
  flex: 0 0 auto;
}

.team-admin-details {
  margin-top: 14px;
  border: 1px solid var(--wire);
  border-radius: var(--radius-sm, 8px);
  background: var(--ink-3);
}

.team-admin-details > summary {
  padding: 12px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.team-admin-details[open] > summary {
  border-bottom: 1px solid var(--wire);
  color: var(--text);
}

.team-admin-details__body {
  padding: 14px;
}

.team-result-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--wire);
  border-radius: var(--radius-sm, 8px);
  background: var(--ink-3);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.team-result-score.is-invalid-reference > :not(.team-result-matchup):not(.team-action-row) {
  display: none;
}

.team-result-score.is-invalid-reference .team-action-row > .btn {
  display: none;
}

.team-result-matchup__vs {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.team-score-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--wire);
  border-radius: var(--radius-sm, 8px);
}

.team-score-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.team-score-section__head small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.team-general-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.team-general-score label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.team-general-score input {
  text-align: center;
}

.team-general-score__separator {
  padding-bottom: 11px;
  color: var(--muted);
}

.team-detail-score-head,
.team-detail-score-row {
  grid-template-columns: minmax(110px, 1.5fr) repeat(3, minmax(54px, .65fr));
}

.team-detail-score-row .form-input {
  min-width: 0;
  text-align: center;
}

.team-public-dashboard {
  display: grid;
  gap: 22px;
}

.team-public-dashboard .panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-table-scroll {
  width: 100%;
  overflow: visible;
}

.team-standings-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.team-standings-table thead th:first-child,
.team-standings-table tbody td:first-child {
  text-align: left;
}

.team-standings-table thead th:first-child,
.team-standings-table tbody td:first-child {
  width: 45%;
  min-width: 0;
}

.team-standings-table thead th:not(:first-child),
.team-standings-table tbody td:not(:first-child) {
  width: 11%;
}

.team-standing-team {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.team-standing-team .rank-num {
  width: auto;
  margin-right: 0;
  text-align: right;
}

.team-standing-team .pair-name {
  max-width: none;
  min-width: 0;
}

.team-section-title {
  margin: 0 0 10px;
}

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

.team-rosters-grid {
  align-items: start;
}

.team-roster-card__body,
.team-matches-list {
  padding: 0 16px 6px;
}

.team-roster-card__head {
  gap: 8px;
  cursor: pointer;
}

.team-roster-card__head .team-shortcut-actions {
  cursor: default;
}

.team-roster-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.team-roster-toggle__icon {
  width: 7px;
  height: 7px;
  margin: 0 4px 3px 12px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s ease;
}

.team-roster-toggle[aria-expanded="true"] .team-roster-toggle__icon {
  margin-bottom: -2px;
  transform: rotate(225deg);
}

.team-category-block + .team-category-block {
  border-top: 1px solid var(--wire);
}

.team-category-title {
  padding: 14px 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.team-category-pairs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-roster-pair {
  padding: 9px 0;
  border-top: 1px solid var(--wire);
  color: var(--text);
  font-size: 13px;
}

.team-roster-pair:first-child {
  border-top: 0;
}

.team-matches-list .match-row {
  margin: 0;
  border-radius: 0;
}

.team-matches-list .match-row + .match-row {
  border-top: 1px solid var(--wire);
}

.team-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}

.team-match-main {
  min-width: 0;
}

.team-match-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-match-side .match-row__result {
  white-space: nowrap;
}

.team-shortcut-actions {
  position: relative;
}


.standings-empty-cell {
  padding: 24px !important;
  color: var(--muted);
  text-align: center !important;
}



.team-roster-card__body > .empty-row {
  margin: 14px 0 8px;
}

.team-full-empty {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

.team-roster-modal-fields {
  display: grid;
  gap: 10px;
}

.team-roster-modal-fields .form-group {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  #team-competition-admin .admin-tools-grid,
  .team-rosters-grid,
  .team-match-panels {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .team-standings-table thead th:first-child,
  .team-standings-table tbody td:first-child {
    width: 38%;
    min-width: 0;
  }

  .team-standings-table thead th:not(:first-child),
  .team-standings-table tbody td:not(:first-child) {
    width: 12.4%;
  }

  .team-standing-team {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 8px;
  }

  .team-standings-table .rank-num {
    width: auto;
    margin-right: 0;
  }
}

@media (max-width: 640px) {
  .team-action-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-config-grid,
  .team-form-grid,
  .team-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-result-matchup {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-general-score {
    gap: 7px;
  }

  .team-match-row {
    align-items: flex-start;
  }

  .team-match-side {
    align-items: flex-end;
    flex-direction: column;
  }
}
#team-fixture-modal .confirm-modal__card,
#team-roster-modal .confirm-modal__card,
#quick-result-modal .confirm-modal__card {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

@media (max-width: 640px) {
  .team-detail-score-head,
  .team-detail-score-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(38px, 44px));
    gap: 6px;
  }

  .team-admin-details__body {
    padding: 10px;
  }

  #team-roster-modal .confirm-modal__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #team-roster-modal-save {
    grid-column: 1 / -1;
  }
}

#confirm-modal {
  z-index: 1301;
}


.team-fixture-mode-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.team-fixture-mode-picker .style-picker__opt,
.team-fixture-mode-picker .style-picker__label {
  width: 100%;
}

.team-fixture-mode-picker .style-picker__label {
  justify-content: flex-start;
  min-height: 36px;
  padding: 9px 12px;
  box-sizing: border-box;
  background: var(--ink-2);
}

.team-fixture-mode-picker .style-picker__label::after {
  content: "";
  flex: 0 0 12px;
  margin-left: auto;
  text-align: right;
}

.team-fixture-mode-picker input[type='radio']:checked + .style-picker__label::after {
  content: "✓";
}

.team-fixture-mode-fields {
  margin-top: 14px;
}

@media (max-width: 640px) {
  .team-fixture-mode-picker {
    grid-template-columns: minmax(0, 1fr);
  }
}

.team-category-block {
  padding: 12px 0 8px;
}

.team-category-block + .team-category-block {
  margin-top: 4px;
}

.team-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 8px);
  background: var(--ink-2);
}

.team-category-title small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: none;
}

.team-category-pairs {
  padding: 4px 10px 0;
}

.team-roster-pair {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.team-roster-pair__slot {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}

.team-matches-list .match-row {
  border: 0;
  background: transparent;
}

.team-matches-list .match-row + .match-row {
  border-top: 1px solid var(--wire);
}

.team-matches-list .match-row:hover {
  background: var(--ink-4);
}

.team-match-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
}

.team-match-entry {
  min-width: 0;
}

.team-match-entry:last-child {
  text-align: right;
}

.team-match-club {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.team-match-pair {
  min-width: 0;
  color: var(--text-hi);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.team-match-versus {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.team-match-footer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px 7px;
  margin-top: 10px;
  text-align: center;
}

.team-match-footer .match-row__extra {
  margin: 0;
  min-width: 0;
  text-align: center;
}

.team-match-footer__separator {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.team-match-result {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px 7px;
  margin-left: 0;
  text-align: center;
}

.team-match-footer .small-meta,
.team-match-result .match-row__sets {
  font-size: 12px;
  line-height: 16px;
}

.team-match-result .match-row__result {
  font-size: 1.15rem;
  line-height: 1;
}

.team-match-result .match-row__sets {
  margin-top: 0;
}

.team-match-result__separator {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.team-repeat-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
  padding: 11px 12px;
  border: 1px solid var(--wire);
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
}

.team-repeat-option:has(input:checked) {
  border-color: var(--wire-2);
  background: var(--ink-2);
}

.team-repeat-option input {
  flex: 0 0 auto;
  margin: 2px 0 0;
}

.team-repeat-option span,
.team-repeat-option small {
  display: block;
}

.team-repeat-option strong {
  color: var(--text-hi);
  font-size: 11px;
  font-weight: 650;
}

.team-repeat-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

#team-fixture-modal-manual-schedule-help {
  margin-bottom: 12px;
}

#team-fixture-modal-schedule-details {
  margin-top: 14px;
}

#team-fixture-modal-schedule-details .team-action-row {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .team-match-row {
    align-items: stretch;
    flex-direction: column;
  }

  .team-match-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .team-match-entry,
  .team-match-entry:last-child {
    text-align: left;
  }

  .team-match-versus {
    text-align: left;
  }

  .team-match-footer,
  .team-match-result {
    justify-content: center;
    text-align: center;
  }
}

.team-matches-list .team-match-row {
  display: block;
  padding: 14px 0;
}

.team-matches-panel--has-space .team-matches-list .team-match-row:last-child {
  border-bottom: 1px solid var(--wire);
}
