.teams-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.teams-list-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.teams-list-shell[hidden],
.team-profile-shell[hidden] {
    display: none !important;
}

.teams-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.teams-header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.teams-subtitle {
    margin: 0;
    max-width: 720px;
    color: var(--accent-white);
    font-size: 15px;
}

.teams-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.teams-notice {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(34, 197, 94, 0.12);
    color: #9fe7a9;
    font-size: 14px;
}

.teams-notice.is-error {
    background: rgba(255, 99, 99, 0.1);
    color: #ff9f9f;
}

.teams-grid-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
    justify-content: start;
    gap: 18px;
}

.team-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    border: 1px solid var(--border-color);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 40%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
        var(--secondary-black);
    padding: 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    text-align: left;
    overflow: hidden;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.team-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24);
}

.team-tile:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(65, 127, 227, 0.28);
}

.team-tile.is-active {
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
}

.team-tile__top,
.team-tile__bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-tile__bottom {
    gap: 6px;
}

.team-tile__name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--primary-white);
    word-break: break-word;
}

.team-tile__meta {
    color: var(--accent-white);
    font-size: 13px;
}

.team-tile__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-white);
    font-size: 12px;
    font-weight: 600;
}

.team-emblem {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, var(--team-accent, #195ad6), rgba(255, 255, 255, 0.12));
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.team-emblem--large {
    width: 118px;
    height: 118px;
    border-radius: 32px;
}

.team-emblem__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.team-emblem__text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.team-emblem--large .team-emblem__text {
    font-size: 38px;
}

.teams-empty-state {
    padding: 44px 24px;
    border-radius: 20px;
    border: 1px dashed var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.teams-empty-state__icon {
    font-size: 36px;
    margin-bottom: 12px;
    color: var(--accent-white);
}

.teams-empty-state h3 {
    margin-bottom: 8px;
    color: var(--primary-white);
    font-size: 22px;
}

.teams-empty-state p {
    max-width: 560px;
    margin: 0 auto;
    color: var(--accent-white);
    font-style: normal;
}

.teams-empty-state--compact {
    margin-top: 8px;
    padding: 28px 20px;
}

.team-profile-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100%;
}

.team-profile-shell__header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-profile-shell__copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-profile-shell__eyebrow {
    color: var(--accent-white);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    font-weight: 700;
}

.team-profile-shell__title {
    margin: 0;
    color: var(--primary-white);
    font-size: clamp(26px, 3vw, 34px);
}

.team-profile-back {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--secondary-black);
    color: var(--primary-white);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.team-profile-back:hover {
    background: var(--accent-black);
}

.team-profile-card {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        var(--secondary-black);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 520px;
}

.team-workspace__nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.team-workspace__tab {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--accent-white);
    border-radius: 999px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.team-workspace__tab:hover {
    border-color: rgba(255, 255, 255, 0.38);
    color: var(--primary-white);
}

.team-workspace__tab.is-active {
    background: var(--primary-white);
    color: var(--primary-black);
    border-color: var(--primary-white);
}

.team-workspace__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.team-workspace__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.team-profile-card__hero {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.team-profile-card__summary {
    flex: 1;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-profile-card__title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-profile-card__title h3 {
    margin: 0;
    color: var(--primary-white);
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.05;
}

.team-profile-card__subtitle {
    color: var(--accent-white);
    font-size: 15px;
}

.team-profile-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.team-profile-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--primary-white);
    font-size: 13px;
    font-weight: 600;
}

.team-profile-card__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.team-profile-stat {
    border-radius: 18px;
    padding: 18px;
    background: var(--accent-black);
    border: 1px solid var(--border-color);
}

.team-profile-stat__value {
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    color: var(--primary-white);
    margin-bottom: 8px;
}

.team-profile-stat__label {
    font-size: 13px;
    color: var(--accent-white);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.team-profile-card__content {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 18px;
}

.team-profile-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-profile-block h4 {
    margin: 0;
    color: var(--primary-white);
    font-size: 17px;
}

.team-profile-block p {
    margin: 0;
    color: var(--accent-white);
}

.team-profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-profile-list__item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--primary-white);
    font-size: 14px;
}

.team-profile-list__item span:last-child {
    color: var(--accent-white);
    text-align: right;
}

.team-players {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.team-players__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.team-players__header h3 {
    margin: 0 0 8px;
    color: var(--primary-white);
    font-size: 24px;
}

.team-players__header p {
    margin: 0;
    color: var(--accent-white);
    max-width: 620px;
}

.team-players__summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--primary-white);
    min-width: 220px;
}

.team-players__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.team-players--locked {
    min-height: 260px;
}

.team-players__locked-card {
    border-radius: 20px;
    border: 1px dashed var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    padding: 28px;
}

.team-players__locked-card h3 {
    margin: 0 0 10px;
    color: var(--primary-white);
    font-size: 24px;
}

.team-players__locked-card p {
    margin: 0;
    color: var(--accent-white);
    max-width: 560px;
}

.team-player-card {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--accent-black);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.team-player-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.team-player-card__number {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: var(--primary-white);
}

.team-player-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-white);
    font-size: 12px;
    font-weight: 700;
}

.team-player-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-player-card__body h4 {
    margin: 0;
    color: var(--primary-white);
    font-size: 20px;
}

.team-player-card__body p {
    margin: 0;
    color: var(--accent-white);
}

.teams-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}

.teams-modal[hidden] {
    display: none !important;
}

.teams-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 18, 0.68);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.teams-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(88vh, 920px);
    overflow: auto;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        var(--primary-black);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
    padding: 24px;
    pointer-events: auto;
}

.teams-modal__dialog--form {
    width: min(880px, 100%);
}

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

.teams-modal__header h3 {
    margin: 0 0 6px;
    color: var(--primary-white);
    font-size: 26px;
}

.teams-modal__header p {
    margin: 0;
    color: var(--accent-white);
    font-size: 14px;
}

.teams-modal__close {
    position: relative;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--secondary-black);
    color: var(--primary-white);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.teams-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.teams-search-shell {
    margin-bottom: 18px;
}

.teams-search-row {
    display: flex;
    align-items: flex-start;
}

.teams-search-field {
    width: 100%;
    margin-bottom: 0;
}

.teams-search-field__control {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.teams-search-field__control .form-control {
    flex: 1 1 auto;
}

.teams-search-field__toggle {
    flex: 0 0 auto;
    white-space: nowrap;
}

.teams-filter-panel {
    margin-top: 14px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.teams-filter-panel[aria-hidden="true"] {
    display: none;
}

.teams-filter-panel__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.teams-filter-panel__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.teams-catalog-card {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--secondary-black);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.teams-catalog-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.teams-catalog-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.teams-catalog-card__body h4 {
    margin: 0;
    color: var(--primary-white);
    font-size: 20px;
}

.teams-catalog-card__body p {
    margin: 0;
    color: var(--accent-white);
    font-size: 14px;
}

.teams-catalog-card__meta {
    color: var(--accent-white);
    font-size: 13px;
}

.teams-catalog-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.teams-catalog-card__actions .btn {
    flex: 1 1 160px;
    justify-content: center;
}

.teams-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.teams-form__hero {
    display: grid;
    grid-template-columns: 164px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.teams-form__hero-copy,
.teams-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.teams-form__grid .form-group:first-child,
.teams-form__grid .form-group:last-child {
    grid-column: span 1;
}

.teams-form__hint {
    margin-top: 8px;
    color: var(--accent-white);
    font-size: 12px;
}

.teams-form__hint--privacy {
    margin: 4px 0 12px;
}

.teams-inline-field {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.teams-inline-field .form-control {
    flex: 1 1 auto;
}

.teams-inline-field__action {
    flex: 0 0 auto;
    white-space: nowrap;
}

.team-visibility-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.team-visibility-option {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 112px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.team-visibility-option:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.34);
}

.team-visibility-option.is-selected {
    border-color: rgba(255, 255, 255, 0.78);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.team-visibility-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.team-visibility-option__content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 16px;
}

.team-visibility-option__title {
    color: var(--primary-white);
    font-size: 16px;
    font-weight: 700;
}

.team-visibility-option__description {
    color: var(--accent-white);
    font-size: 13px;
    line-height: 1.45;
}

.team-logo-preview {
    width: 164px;
    height: 164px;
    border-radius: 32px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, rgba(25, 90, 214, 0.8), rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.team-logo-preview__initials {
    color: #ffffff;
    font-size: 48px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.team-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.is-teams-modal-open {
    overflow: hidden;
}

:root[data-theme="light"] .team-tile {
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 247, 251, 0.96)),
        var(--secondary-black);
}

:root[data-theme="light"] .team-tile:hover,
:root[data-theme="light"] .team-tile.is-active {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

:root[data-theme="light"] .teams-notice {
    background: rgba(34, 197, 94, 0.12);
    color: #0f7a32;
}

:root[data-theme="light"] .teams-notice.is-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b42318;
}

:root[data-theme="light"] .teams-empty-state,
:root[data-theme="light"] .team-profile-block {
    background: rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] .team-profile-card,
:root[data-theme="light"] .teams-modal__dialog {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.96)),
        var(--primary-black);
}

:root[data-theme="light"] .teams-filter-panel {
    background: rgba(255, 255, 255, 0.78);
}

:root[data-theme="light"] .team-visibility-option {
    background: rgba(255, 255, 255, 0.82);
}

:root[data-theme="light"] .team-visibility-option.is-selected {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}

:root[data-theme="light"] .team-workspace__tab.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

:root[data-theme="light"] .team-players__summary,
:root[data-theme="light"] .team-player-card,
:root[data-theme="light"] .team-players__locked-card {
    background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 920px) {
    .team-profile-card__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-profile-card__content {
        grid-template-columns: 1fr;
    }

    .teams-form__hero {
        grid-template-columns: 1fr;
    }

    .teams-filter-panel__grid {
        grid-template-columns: 1fr 1fr;
    }

    .team-logo-preview {
        width: 132px;
        height: 132px;
    }
}

@media (max-width: 640px) {
    .teams-actions {
        width: 100%;
    }

    .teams-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .teams-modal {
        padding: 12px;
    }

    .teams-modal__dialog {
        padding: 18px;
        border-radius: 20px;
    }

    .team-profile-card {
        padding: 20px;
        min-height: unset;
    }

    .team-profile-card__stats {
        grid-template-columns: 1fr;
    }

    .team-workspace__nav {
        flex-direction: column;
        align-items: stretch;
    }

    .team-workspace__tab {
        justify-content: center;
    }

    .team-players__summary {
        width: 100%;
        min-width: 0;
    }

    .teams-form__hero-copy,
    .teams-form__grid {
        grid-template-columns: 1fr;
    }

    .teams-filter-panel__grid {
        grid-template-columns: 1fr;
    }

    .teams-search-field__control,
    .teams-filter-panel__actions,
    .teams-inline-field {
        flex-direction: column;
    }

    .team-visibility-options {
        grid-template-columns: 1fr;
    }

    .teams-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-tile {
        min-height: 170px;
        padding: 16px;
        border-radius: 18px;
    }

    .team-emblem {
        width: 60px;
        height: 60px;
        border-radius: 18px;
    }

    .team-tile__name {
        font-size: 17px;
    }
}

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