/* Elenco squadre — coerente con managers / team (MASTER XG) */
.teams-page {
  --ts-line: rgba(148, 163, 184, 0.2);
  --ts-violet: rgba(167, 139, 250, 0.45);
  --ts-cyan: rgba(56, 189, 248, 0.35);
}

.teams-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--ts-line);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.55));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.teams-toolbar form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
  flex: 1;
  min-width: 0;
}
.teams-toolbar .input {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--ts-line);
  border-radius: 10px;
  color: #f1f5f9;
}
.teams-toolbar .btn {
  border-radius: 10px;
  font-weight: 700;
}

.teams-shell {
  border-radius: 16px;
  border: 1px solid var(--ts-line);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.5));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.teams-table-wrap {
  margin-top: 0;
}

.teams-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}
.teams-table thead th {
  text-align: left;
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.97);
  border-bottom: 1px solid var(--ts-line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.teams-table tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: middle;
  color: #e2e8f0;
}
.teams-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}
.teams-table tbody tr:last-child td {
  border-bottom: 0;
}

.tt-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}
.tt-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--ts-line);
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 40px;
}
.tt-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}
.tt-name small {
  color: #94a3b8;
  font-weight: 600;
}
.tt-manager,
.tt-roster {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tt-manager {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 700;
}
.tt-manager:hover {
  text-decoration: underline;
}
.team-mgr-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}
.team-mgr-chip--free {
  background: rgba(52, 211, 153, .14);
  border: 1px solid rgba(52, 211, 153, .45);
  color: #a7f3d0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.team-mgr-chip--free i {
  font-size: .78rem;
  opacity: .95;
}
.tt-manager--free {
  text-decoration: none;
  font-weight: 800;
}
.tt-manager--free.team-mgr-chip--free,
.tt-manager.tt-manager--free .team-mgr-chip--free {
  color: #a7f3d0;
}
.tt-forza {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  white-space: nowrap;
}

.teams-page .xg-stars .fa-star,
.teams-page .xg-stars .fa-star-half-stroke,
.teams-page .xg-stars .fa-regular.fa-star {
  vertical-align: middle;
}
.teams-page .xg-stars {
  display: inline-flex;
  gap: 2px;
  font-size: 0.88rem;
  line-height: 1;
}
.teams-page .xg-stars-score {
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.95;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
}

/* Sortable header */
.th-sort {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}
.th-sort::after {
  content: "⇅";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.45;
  font-size: 12px;
}
.th-sort[aria-sort="asc"]::after {
  content: "▲";
  opacity: 0.9;
}
.th-sort[aria-sort="desc"]::after {
  content: "▼";
  opacity: 0.9;
}

.sortbar {
  display: none;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  padding: 0 1rem 0.5rem;
  flex-wrap: wrap;
}
.sortbar .input {
  min-width: 70px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--ts-line);
  border-radius: 10px;
  color: #f1f5f9;
}

.td-label {
  display: none;
}

@media (max-width: 700px) {
  .teams-toolbar {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.65rem;
    border-radius: 12px;
    gap: 8px;
  }
  .teams-toolbar form {
    gap: 8px;
  }
  .teams-toolbar .input {
    min-height: 34px;
    font-size: 0.86rem;
  }
  .teams-toolbar .btn {
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
  }

  .sortbar {
    display: flex;
    margin: 0 0 8px;
    padding: 0 0.75rem 0.35rem;
    gap: 6px;
  }
  .sortbar .input { min-height: 34px; font-size: 0.84rem; }
  .sortbar .btn { min-height: 34px; font-size: 0.83rem; padding: 0.35rem 0.7rem; }
  .teams-table thead {
    display: none;
  }
  .teams-table,
  .teams-table tbody,
  .teams-table tr,
  .teams-table td {
    display: block;
    width: 100%;
  }
  .teams-table tbody tr {
    border: 1px solid var(--ts-line);
    border-radius: 12px;
    margin-bottom: 7px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.45);
  }
  .teams-table tbody td {
    border-bottom: 0;
    padding: 6px 11px;
  }
  .td-team {
    padding-bottom: 6px;
    background: rgba(15, 23, 42, 0.55);
    border-bottom: 1px solid var(--ts-line);
  }
  .td-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 90px;
    color: #94a3b8;
    font-size: 12px;
    margin-right: 6px;
    font-weight: 700;
  }
  .tt-team {
    min-width: 0;
    gap: 8px;
  }
  .tt-logo {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
  }
  .tt-name .link-strong strong {
    font-size: 0.98rem;
  }
  .m-sort {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }
  .m-sort::after {
    content: "⇅";
    opacity: 0.5;
    font-size: 12px;
  }
  .m-sort[data-dir="asc"]::after {
    content: "▲";
    opacity: 0.9;
  }
  .m-sort[data-dir="desc"]::after {
    content: "▼";
    opacity: 0.9;
  }
}

.teams-pager-card {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--ts-line);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.45));
}

.teams-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
}
