/* Team page — AIR-960.
   Tab chrome, grants table, scope badge. Tokens from lib/style.css. */

/* ===== Tablist ===== */

.team-root {
  display: flex;
  flex-direction: column;
  gap: var(--s-24);
}

.team-tablist {
  display: flex;
  gap: var(--s-4);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--s-8);
  overflow-x: auto;
  overflow-y: hidden;
}

.team-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: var(--s-12) var(--s-16);
  margin-bottom: -1px; /* overlap the tablist underline */
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}

.team-tab:hover {
  color: var(--text);
}

.team-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.team-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== Panel ===== */

.team-panel {
  min-height: 200px;
}

.team-loading {
  color: var(--muted);
  font-size: 14px;
  padding: var(--s-24);
}

/* ===== Action bar (Invite) ===== */

.team-actions {
  display: flex;
  gap: var(--s-12);
  align-items: center;
  justify-content: flex-end;
  margin-bottom: var(--s-16);
}

.team-invite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.team-invite-hint {
  color: var(--muted);
  font-size: 13px;
}

/* ===== Invite modal ===== */

.invite-modal {
  max-width: 480px;
  padding: var(--s-24);
}

.invite-modal-head {
  margin-bottom: var(--s-16);
}

.invite-modal-title {
  margin: 0 0 var(--s-4);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.invite-modal-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.invite-modal-form {
  display: flex;
  flex-direction: column;
}

.invite-modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s-12);
  margin-bottom: var(--s-4);
}

.invite-modal-input,
.invite-modal-select {
  width: 100%;
  padding: var(--s-8) var(--s-12);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.invite-modal-input:focus,
.invite-modal-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(253, 108, 29, 0.15);
}

.invite-modal-error {
  margin-top: var(--s-12);
  padding: var(--s-8) var(--s-12);
  background: rgba(180, 40, 40, 0.08);
  color: #a52a2a;
  border-radius: 6px;
  font-size: 13px;
}

:root.dark-mode .invite-modal-error {
  color: #e37a7a;
}

.invite-modal-actions {
  display: flex;
  gap: var(--s-8);
  justify-content: flex-end;
  margin-top: var(--s-24);
}

/* ===== Grants table ===== */

.team-table-card {
  padding: 0;
  overflow: hidden;
}

.team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.team-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--border-color);
  background: var(--code-bg);
}

.team-table tbody td {
  padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text);
}

.team-table tbody tr:last-child td {
  border-bottom: 0;
}

.team-table tbody tr:hover {
  background: var(--hover-bg);
}

.team-col-party {
  font-weight: 500;
}

.team-col-target code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
  background: var(--code-bg);
  border-radius: 4px;
}

.team-col-action {
  text-align: right;
}

.team-row-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.team-row-link:hover {
  text-decoration: underline;
}

.team-row-revoked td,
.team-row-expired td {
  color: var(--muted);
}

/* ===== Status pill ===== */

.team-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.team-status-active {
  background: rgba(34, 139, 34, 0.12);
  color: #227a22;
}

.team-status-expired {
  background: rgba(200, 140, 0, 0.12);
  color: #a66a00;
}

.team-status-revoked {
  background: rgba(180, 40, 40, 0.12);
  color: #a52a2a;
}

.team-status-unknown {
  background: var(--code-bg);
  color: var(--muted);
}

/* Dark-mode overrides — the solid hues above can look too muddy on
   dark surfaces. Boost lightness / saturation. */
:root.dark-mode .team-status-active  { color: #6bd67b; }
:root.dark-mode .team-status-expired { color: #e5b25a; }
:root.dark-mode .team-status-revoked { color: #e37a7a; }

/* ===== Invite chooser (AIR-1135) ===== */

.invite-chooser {
  max-width: 560px;
  padding: var(--s-24);
}

.invite-chooser-head {
  margin-bottom: var(--s-16);
}

.invite-chooser-title {
  margin: 0 0 var(--s-4);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.invite-chooser-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.invite-chooser-body {
  min-height: 120px;
}

.invite-chooser-loading {
  color: var(--muted);
  font-size: 14px;
  padding: var(--s-16) 0;
}

.invite-chooser-error {
  margin-top: var(--s-12);
  padding: var(--s-8) var(--s-12);
  background: rgba(180, 40, 40, 0.08);
  color: #a52a2a;
  border-radius: 6px;
  font-size: 13px;
}

:root.dark-mode .invite-chooser-error {
  color: #e37a7a;
}

.invite-chooser-scopes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-12);
}

@media (max-width: 520px) {
  .invite-chooser-scopes { grid-template-columns: 1fr; }
}

.invite-chooser-scope {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-8);
  text-align: left;
  padding: var(--s-16);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.invite-chooser-scope:hover {
  border-color: var(--border-color-strong);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.invite-chooser-scope:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.invite-chooser-scope.is-selected {
  border-color: var(--accent);
  background: var(--hover-bg);
}

.invite-chooser-scope-icon {
  font-size: 18px;
  color: var(--accent);
}

.invite-chooser-scope-label {
  font-weight: 700;
  font-size: 15px;
}

.invite-chooser-scope-blurb {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.invite-chooser-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s-4);
  margin-bottom: var(--s-4);
}

.invite-chooser-select {
  width: 100%;
  padding: var(--s-8) var(--s-12);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.invite-chooser-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(253, 108, 29, 0.15);
}

.invite-chooser-confirm {
  margin: 0 0 var(--s-12);
  font-size: 14px;
  color: var(--text);
}

.invite-chooser-back {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s-4) 0;
  margin-top: var(--s-12);
}

.invite-chooser-back:hover {
  text-decoration: underline;
}

.invite-chooser-actions {
  display: flex;
  gap: var(--s-8);
  justify-content: flex-end;
  margin-top: var(--s-24);
}

/* ===== Per-grant detail (AIR-961) ===== */

.team-detail {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.team-detail-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

.team-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  align-self: flex-start;
}

.team-detail-back:hover {
  color: var(--accent);
}

.team-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-16);
  flex-wrap: wrap;
}

.team-detail-title-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.team-detail-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.team-detail-meta {
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.team-detail-actions {
  display: flex;
  gap: var(--s-8);
  flex-wrap: wrap;
}

.team-detail-section {
  padding: var(--s-16) var(--s-24);
}

.team-detail-section--table {
  padding: 0;
}

.team-detail-section--table .team-detail-section-title {
  padding: var(--s-16) var(--s-24);
  margin: 0;
  border-bottom: 1px solid var(--border-color);
}

.team-detail-section-title {
  margin: 0 0 var(--s-12);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-detail-section-hint,
.team-detail-section-text {
  margin: 0 0 var(--s-12);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.team-detail-section-hint {
  color: var(--muted);
}

.team-detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.team-detail-error {
  padding: var(--s-8) var(--s-12);
  background: rgba(180, 40, 40, 0.08);
  color: #a52a2a;
  border-radius: 6px;
  font-size: 13px;
}

:root.dark-mode .team-detail-error {
  color: #e37a7a;
}

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

.team-detail-prop-key {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.team-detail-prop-val {
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}

.team-detail-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

.team-detail-history-item {
  display: flex;
  gap: var(--s-12);
  align-items: flex-start;
}

.team-detail-history-icon {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.team-detail-history-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.team-detail-history-body {
  font-size: 13px;
  color: var(--muted);
}

/* ===== Scope badge (web component inherits these) ===== */

.grant-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border-color);
}

.grant-scope-badge i {
  font-size: 11px;
  color: var(--muted);
}

.grant-scope-tenant  i { color: var(--accent); }
.grant-scope-account i { color: #3b82f6; }

:root.dark-mode .grant-scope-account i { color: #6aa9ff; }
