/* ============================================================
   TEAM MANAGEMENT — Full member-oriented team panel
   ============================================================ */

/* ── Header card ── */
.team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #f4f4f5;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  padding: 1.1rem 1.35rem;
  box-shadow: 0 2px 10px rgba(15,23,42,.05);
}
.team-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.team-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #e4e4e7;
  color: #52525b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.team-header-icon i { width: 18px; height: 18px; }
.team-header-title {
  font-size: 15px;
  font-weight: 700;
  color: #18181b;
  line-height: 1.2;
}
.team-header-sub {
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 2px;
}
.team-badge-count {
  font-size: 12px;
  font-weight: 600;
  color: #a1a1aa;
  background: transparent;
  border: none;
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* ── Filter bar ── */
.team-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Inline add button */
.team-add-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: #18181b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.team-add-inline-btn:hover {
  background: #27272a;
}
.team-filter-chip {
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #71717a;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.team-filter-chip:hover {
  border-color: #a1a1aa;
  color: #18181b;
}
.team-filter-chip.active {
  background: #18181b;
  color: #fff;
  border-color: #18181b;
}
.team-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  display: flex;
  align-items: center;
}
.team-search-wrap > i,
.team-search-wrap > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #a1a1aa;
  pointer-events: none;
  z-index: 1;
}
.team-search-input {
  width: 100%;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 6px 10px 6px 30px;
  font-size: 12.5px;
  outline: none;
  background: #fff;
  color: #18181b;
  transition: border-color .15s;
}
.team-search-input:focus {
  border-color: #18181b;
}
.team-search-input::placeholder {
  color: #a1a1aa;
}

/* ── Members list ── */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15,23,42,.05);
}

/* Individual member row */
.team-row {
  display: grid;
  grid-template-columns: 250px 80px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid #f4f4f5;
  transition: background 0.12s;
  position: relative;
  cursor: pointer;
}
.team-row:last-child { border-bottom: none; }
.team-row:hover { background: #fafafa; }

.team-row-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
}

/* Avatar */
.team-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #f4f4f5;
  color: #3a3a40;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.team-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.team-row-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-row-email {
  font-size: 12px;
  color: #a1a1aa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Role badge */
.team-role-badge {
  font-size: 10px;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  width: fit-content;
}
.team-role-badge.admin {
  background: #dcfce7;
  color: #166534;
}
.team-role-badge.editor {
  background: #f4f4f5;
  color: #18181b;
}
.team-role-badge.viewer {
  background: #f4f4f5;
  color: #71717a;
}
.team-role-badge.owner {
  background: #f4f4f5;
  color: #3f3f46;
}

/* Bot chips */
.team-bots-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}
.team-bot-chip {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 5px;
  background: #f4f4f5;
  color: #52525b;
  white-space: nowrap;
  border: none;
}
.team-bot-chip.all {
  background: #f4f4f5;
  color: #3f3f46;
  border-color: #d4d4d8;
}
.team-bot-more {
  font-size: 10.5px;
  color: #a1a1aa;
  font-weight: 500;
}

/* Last access & actions in row */
.team-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}
.team-last-access {
  font-size: 11.5px;
  color: #a1a1aa;
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
}
.team-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.team-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  transition: background 0.12s, color 0.12s;
}
.team-action-btn:hover {
  background: #f4f4f5;
  color: #18181b;
}
.team-action-btn.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* Empty state */
.team-empty {
  padding: 3rem;
  text-align: center;
  color: #a1a1aa;
  font-size: 13px;
}
.team-empty i {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  opacity: 0.4;
}

/* Section headers */
.team-section-header {
  display: flex;
  align-items: center;
  padding: 10px 20px 6px;
  gap: 10px;
}
.team-section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #f0f0f0;
}
.team-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ── Invite/Add member card ── */
.team-add-card {
  background: #f4f4f5;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  padding: 1.35rem;
  box-shadow: 0 2px 10px rgba(15,23,42,.05);
}
.team-add-title {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
  margin-bottom: 0.85rem;
}
.team-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.team-add-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 150px;
}
.team-add-field i,
.team-add-field svg {
  position: absolute;
  left: 0.75rem;
  width: 14px;
  height: 14px;
  color: #a1a1aa;
  pointer-events: none;
  z-index: 1;
}
.team-add-input {
  width: 100%;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 0.55rem 0.75rem 0.55rem 2.2rem;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  background: #fafafa;
}
.team-add-input:focus {
  border-color: #18181b;
  background: #fff;
}
.team-role-select {
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-size: 12.5px;
  outline: none;
  background: #fafafa;
  color: #18181b;
  cursor: pointer;
  min-width: 100px;
  transition: border-color .15s;
  appearance: auto;
}
.team-role-select:focus {
  border-color: #18181b;
  background: #fff;
}
.team-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  background: #18181b;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.team-add-btn:hover:not(:disabled) { background: #27272a; }
.team-add-btn:disabled { background: #d4d4d8; color: #fff; cursor: not-allowed; }
.team-add-btn i { width: 13px; height: 13px; }
.team-add-feedback {
  font-size: 12px;
  margin-top: 8px;
}

/* ── Member detail modal ── */
.team-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  z-index: 1300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.team-modal-overlay.open {
  display: flex;
}
.team-modal {
  background: #fff;
  border-radius: 20px;
  border: 1px solid #e4e4e7;
  padding: 0;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.team-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f4f4f5;
  flex-shrink: 0;
}
.team-modal-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.team-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #18181b;
  margin: 0;
}
.team-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #a1a1aa;
  padding: 4px;
  border-radius: 8px;
  transition: background .12s;
  flex-shrink: 0;
}
.team-modal-close:hover {
  background: #f4f4f5;
  color: #18181b;
}
.team-modal-close i { width: 18px; height: 18px; }

.team-modal-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.team-modal-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f4f4f5;
  border: 1.5px solid rgb(99 102 241 / 0%);
  color: rgb(24 24 27);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.team-modal-name {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}
.team-modal-email {
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 1px;
}

.team-modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}

/* Modal field group */
.team-modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.team-modal-label {
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  text-transform: none;
  letter-spacing: 0;
}
.team-modal-input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e4e4e7;
  font-size: 13px;
  color: #18181b;
  outline: none;
  transition: border-color .12s;
  background: #fff;
}
.team-modal-input:focus { border-color: #a1a1aa; }
.team-modal-input:disabled { background: #fafafa; color: #a1a1aa; cursor: not-allowed; }

.team-modal-select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e4e4e7;
  font-size: 13px;
  color: #18181b;
  outline: none;
  background: #fff;
  cursor: pointer;
  appearance: auto;
}
.team-modal-select:focus { border-color: #a1a1aa; }

/* Bot access in modal */
.team-modal-bots-title {
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 6px;
}
.team-modal-bots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  overflow: hidden;
}
.team-modal-bot-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #f4f4f5;
  font-size: 13px;
  color: #18181b;
  gap: 0;
}
.team-modal-bot-row:nth-last-child(-n+2) { border-bottom: none; }
.team-modal-bot-row:nth-child(odd) { border-right: 1px solid #f4f4f5; }
.team-modal-bot-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.team-modal-bot-row label span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}
.team-modal-bot-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #18181b;
  flex-shrink: 0;
  cursor: pointer;
}

/* Permissions per bot (hidden by default in simplified mode) */
.team-modal-perms {
  display: none;
}
.team-modal-perm-chip {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f4f4f5;
  color: #71717a;
  border: 1px solid #e4e4e7;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.team-modal-perm-chip.active {
  background: #18181b;
  color: #fff;
  border-color: #18181b;
}
.team-modal-perm-chip:hover:not(.active) {
  border-color: #a1a1aa;
  color: #18181b;
}

/* Modal info section */
.team-modal-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #f4f4f5;
}

/* Modal footer */
.team-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid #f4f4f5;
  gap: 8px;
  flex-shrink: 0;
}
.team-modal-btn {
  padding: 7px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.team-modal-btn.primary {
  background: #18181b;
  color: #fff;
  border-color: #18181b;
}
.team-modal-btn.primary:hover { background: #27272a; }
.team-modal-btn.primary:disabled { background: #d4d4d8; border-color: #d4d4d8; cursor: not-allowed; }
.team-modal-btn.ghost {
  background: #fff;
  color: #71717a;
  border-color: #e4e4e7;
}
.team-modal-btn.ghost:hover {
  background: #fafafa;
  color: #18181b;
}
.team-modal-btn.danger {
  background: #fff;
  color: #dc2626;
  border-color: #fecaca;
}
.team-modal-btn.danger:hover {
  background: #fef2f2;
}
.team-modal-btn i { width: 14px; height: 14px; }

/* Modal info row */
.team-modal-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #a1a1aa;
}
.team-modal-info-value {
  color: #52525b;
  font-weight: 500;
}

/* Status badge */
.team-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.team-status-dot.active { background: #22c55e; }
.team-status-dot.invited { background: #f59e0b; }
.team-status-dot.disabled { background: #d4d4d8; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .team-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .team-bots-cell {
    max-width: 100%;
  }
  .team-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .team-search-wrap {
    max-width: 100%;
  }
  .team-add-form {
    flex-direction: column;
  }
  .team-meta {
    justify-content: flex-start;
  }
}
