.teams-page,
.team-editor-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.teams-header,
.team-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.teams-title h1,
.team-editor-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.teams-title p,
.team-editor-title p {
  margin: 0;
  color: var(--muted);
}

.teams-card,
.team-editor-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-mid);
}

.teams-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.team-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-mid);
  border-color: var(--border);
  background: var(--card);
}

.team-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.team-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-ghost-strong);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 17px;
}

.team-meta {
  font-size: 12px;
  color: var(--muted);
}

.team-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn-danger {
  color: var(--danger, #b42318);
}

.icon-btn-danger:hover {
  color: #fff;
  background: var(--danger, #b42318);
}

.team-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.team-icon-picker {
  width: 100%;
  position: relative;
  z-index: 5;
}

.team-icon-picker.is-open {
  z-index: 40;
}

.team-icon-picker-toggle {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 6px 10px;
  box-shadow: var(--shadow-soft);
}

.team-icon-picker-toggle:hover,
.team-icon-picker-toggle:focus {
  border-color: var(--accent);
  background: var(--card);
  color: var(--text);
}

.team-icon-picker-current-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}

.team-icon-picker-menu {
  width: 100%;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-mid);
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.team-icon-picker-option {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 18px;
}

.team-icon-picker-option:hover {
  border-color: var(--accent);
  background: var(--accent-ghost);
}

.team-icon-picker-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-ghost-strong);
  color: var(--accent);
}

.team-icon-picker-check {
  position: absolute;
  right: 6px;
  top: 4px;
  font-size: 12px;
}

.team-editor-card .collection-multiselect {
  width: 100%;
  position: relative;
  z-index: 5;
}

.team-editor-card .collection-multiselect.is-open {
  z-index: 30;
}

.team-editor-card .collection-multiselect-toggle {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 6px 10px;
  box-shadow: var(--shadow-soft);
}

.team-editor-card .collection-multiselect-toggle:hover,
.team-editor-card .collection-multiselect-toggle:focus {
  border-color: var(--accent);
  background: var(--card);
  color: var(--text);
}

.team-editor-card .collection-multiselect-menu {
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-mid);
  z-index: 35;
}

.team-editor-card .collection-multiselect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  white-space: normal;
  cursor: pointer;
}

.team-editor-card .collection-multiselect-item:last-child {
  margin-bottom: 0;
}

.team-editor-card .collection-multiselect-item:hover {
  background: var(--accent-ghost);
}

.team-editor-card .collection-multiselect-item .form-check-input {
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.team-editor-card .collection-multiselect-item .form-check-label {
  line-height: 1.25;
}

.collection-multiselect-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: transparent;
  z-index: 10;
  padding: 0;
}

@media (max-width: 900px) {
  .team-editor-grid {
    grid-template-columns: 1fr;
  }

  .team-icon-picker-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .teams-page,
  .team-editor-page {
    gap: 12px;
  }

  .teams-header,
  .team-editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .teams-title h1,
  .team-editor-title h1 {
    margin: 0 0 4px;
    font-size: 24px;
  }

  .teams-title p,
  .team-editor-title p {
    font-size: 14px;
    line-height: 1.35;
  }

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

  .team-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .team-icon-picker-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .teams-title h1,
  .team-editor-title h1 {
    font-size: 22px;
  }

  .teams-header,
  .team-editor-header {
    align-items: stretch;
  }

  .teams-header .btn,
  .team-editor-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .team-editor-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
}
