/* ==================================================================
   Settings > Teams (th-team-*)
   ------------------------------------------------------------------
   Layout and the Teams prototype's own values (Teams.dc.html), on
   production tokens. Shared primitives come from
   threshold-operational-components.css; the directory grid is the
   production ThresholdGrid; buttons and pills are cc-btn / cc-pill.
   Where the Teams prototype differs from the handoff primitives (a
   560px dialog, ink-2 information text after the contrast pass, the
   18px banner gutter), the delta is scoped to .th-team-page here.
   ================================================================== */

.th-team-page { display: flex; flex-direction: column; min-width: 0; }
.th-team-page input::placeholder { color: var(--th-ink-2); opacity: 1; }
.th-team-mono { font-family: var(--th-font-mono); font-size: 11.5px; }
.th-team-nowrap { flex: none; white-space: nowrap; }

/* ---------- directory head ---------- */
.th-team-sub {
  margin-top: 4px;
  font-size: var(--th-size-13);
  color: var(--th-ink-2);
  max-width: 640px;
  line-height: 1.5;
}
.th-team-gutter { padding: 0 24px 24px; }

/* ---------- directory grid: Teams prototype deltas on the shared grid ---------- */
.th-team-page .th-grid-search { flex: 1 1 220px; max-width: 340px; color: var(--th-ink-2); }
.th-team-page .th-grid-meta { flex-wrap: wrap; color: var(--th-ink-2); }
.th-team-page .th-grid-meta .spacer { flex: 1; }
.th-team-page .th-grid-wrap { overflow-x: auto; }
.th-team-page .th-grid { min-width: 720px; }
.th-team-page .th-grid thead th { color: var(--th-ink-2); }
.th-team-page .th-grid td.is-num { font-size: 12px; }
.th-team-page .th-grid-state { color: var(--th-ink-2); }
.th-team-page .th-grid-state .glyph { color: var(--th-ink-2); margin-bottom: 0; }
.th-team-page .th-grid-state .body { max-width: 420px; color: var(--th-ink-2); line-height: 1.5; }
.th-team-page .th-grid-state .cc-btn { margin-top: 4px; }
.th-team-page .cc-pill { white-space: nowrap; }
.th-team-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 11.5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--th-ink-2);
  cursor: pointer;
}
.th-team-reset:hover:not(:disabled) { background: var(--th-paper-2); color: var(--th-ink); }
.th-team-reset:disabled { cursor: default; }
.th-team-reset:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-team-count.is-warn { color: var(--th-warn-ink); }
.th-team-refs { font-size: var(--th-size-13); color: var(--th-ink); }
.th-team-refs.is-none { color: var(--th-ink-2); }
.th-team-updated { font-family: var(--th-font-mono); font-size: 12px; color: var(--th-ink-2); white-space: nowrap; }
.th-team-load-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--th-risk);
  background: var(--th-risk-soft);
  color: var(--th-risk-ink);
  font-size: var(--th-size-13);
}
.th-team-load-error__text { flex: 1; }
.th-team-alert-btn {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: var(--th-radius-3);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.th-team-alert-btn:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-team-load-error.is-page {
  margin: 14px 24px 0;
  border: 1px solid var(--th-risk);
  border-radius: var(--th-radius-5);
}

/* ---------- restricted (403) ---------- */
.th-team-page .th-denied { margin: 0; }
.th-team-page .th-denied__title { font: 600 var(--th-size-15) var(--th-font-sans); }

/* ---------- detail head ---------- */
.th-team-back { padding: 16px 24px 0; }
.th-team-back a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--th-ink-2);
  text-decoration: none;
}
.th-team-back a:hover { color: var(--th-ink); }
.th-team-gutter.is-detail { padding-top: 14px; }
.th-team-head-main { min-width: 0; }
.th-team-head-row {
  padding: 10px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.th-team-title {
  margin: 0;
  font-family: var(--th-font-serif);
  font-weight: 500;
  font-size: var(--th-size-24);
  letter-spacing: -0.012em;
  color: var(--th-ink);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.th-team-actions { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }
.th-team-btn-archive { color: var(--th-risk-ink); }
.th-team-btn-archive:hover { background: var(--th-risk-soft); border-color: var(--th-risk); color: var(--th-risk-ink); }
.th-team-lock-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--th-ink-2);
}
.th-team-lock-note .th-team-mono { font-size: 11px; }

/* ---------- banners and facts ---------- */
.th-team-banner {
  margin: 14px 24px 0;
  padding: 11px 14px;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}
.th-team-banner.is-neutral { border-color: var(--th-line); }
.th-team-banner.is-neutral > svg { color: var(--th-ink-2); }
.th-team-facts {
  margin: 14px 24px 0;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-5);
  background: var(--th-paper-sunk);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.th-team-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.th-team-fact__label {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--th-ink-2);
  font-weight: 600;
}
.th-team-fact__value { font-family: var(--th-font-mono); font-size: 13px; color: var(--th-ink); }
.th-team-fact__value.is-text { font-family: var(--th-font-sans); overflow-wrap: anywhere; }
.th-team-fact-sep { width: 1px; height: 26px; background: var(--th-line); flex: none; }
.th-team-facts__foot {
  flex-basis: 100%;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--th-font-mono);
  font-size: 11px;
  color: var(--th-ink-2);
  border-top: 1px solid var(--th-line-soft);
  padding-top: 8px;
  margin-top: 2px;
}

/* ---------- tabs ---------- */
.th-team-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 14px 24px 0;
  border-bottom: 1px solid var(--th-line);
  overflow-x: auto;
}
.th-team-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 9px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--th-ink-2);
}
.th-team-tab[aria-selected="true"] { color: var(--th-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--th-advant); }
.th-team-tab:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; border-radius: 2px; }
.th-team-tab__count { font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); font-weight: 400; }

/* ---------- members tab ---------- */
.th-team-tc-wrap { container-type: inline-size; container-name: th-tc; padding: 16px 24px 28px; }
.th-team-tc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@container th-tc (max-width: 760px) { .th-team-tc-grid { grid-template-columns: minmax(0, 1fr); } }
.th-team-members-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--th-line);
  flex-wrap: wrap;
}
.th-team-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 320px;
  background: var(--th-paper);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  color: var(--th-ink-2);
  font-size: var(--th-size-13);
}
.th-team-search:focus-within { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-team-search input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--th-ink);
  flex: 1;
  min-width: 0;
  font-size: var(--th-size-13);
}
.th-team-spacer { flex: 1; }
.th-team-add-host { position: relative; display: inline-block; }
.th-team-mem-wrap { container-type: inline-size; container-name: th-mem; }
.th-team-mem { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--th-size-14); }
.th-team-mem th {
  text-align: left;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--th-ink-2);
  background: var(--th-paper-2);
  border-bottom: 1px solid var(--th-line);
  white-space: nowrap;
}
.th-team-mem th.is-since { width: 120px; }
.th-team-mem th.is-act { text-align: right; width: 90px; }
.th-team-mem td { padding: 9px 14px; border-bottom: 1px solid var(--th-line-soft); vertical-align: middle; }
.th-team-mem tbody tr:hover { background: var(--th-paper-2); }
.th-team-mem tbody tr.is-unstaffed { background: var(--th-risk-soft); }
.th-team-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.th-team-person__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.th-team-person__name { font-weight: 500; color: var(--th-ink); overflow-wrap: anywhere; }
.th-team-person__name.is-withheld { font-weight: 400; color: var(--th-ink-2); }
.th-team-person__sub { font-size: 11.5px; color: var(--th-ink-2); overflow-wrap: anywhere; }
.th-team-access { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.th-team-access__note { font-size: 11px; color: var(--th-ink-2); }
.th-team-since { font-family: var(--th-font-mono); font-size: 12px; color: var(--th-ink-2); white-space: nowrap; }
.th-team-since__label { display: none; font-family: var(--th-font-sans); }
.th-team-mem td.is-act { text-align: right; }
.th-team-remove {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  background: var(--th-paper);
  color: var(--th-ink-2);
  cursor: pointer;
}
.th-team-remove:hover { color: var(--th-risk-ink); border-color: var(--th-risk); background: var(--th-risk-soft); }
.th-team-remove:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
@container th-mem (max-width: 540px) {
  .th-team-mem thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .th-team-mem, .th-team-mem tbody { display: block; }
  .th-team-mem tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--th-line-soft); }
  .th-team-mem tbody td { display: block; border-bottom: 0; }
  .th-team-mem td.is-person { grid-column: 1; grid-row: 1; padding-bottom: 6px; }
  .th-team-mem td.is-act { grid-column: 2; grid-row: 1; align-self: start; }
  .th-team-mem td.is-access { grid-column: 1 / -1; grid-row: 2; padding: 0 14px 6px 50px; }
  .th-team-mem td.is-since { grid-column: 1 / -1; grid-row: 3; padding: 0 14px 10px 50px; white-space: normal; }
  .th-team-since__label { display: inline; }
}
.th-team-members-empty { padding: 40px 24px; }
.th-team-members-empty .th-empty__body { max-width: 400px; }
.th-team-no-match { padding: 24px; text-align: center; font-size: var(--th-size-13); color: var(--th-ink-2); }
.th-team-withheld { margin: 10px 12px 0; }
.th-team-side { display: flex; flex-direction: column; gap: 14px; }
.th-team-side-card {
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-5);
  background: var(--th-paper-sunk);
  padding: 12px 14px;
  font-size: var(--th-size-13);
  color: var(--th-ink-2);
  line-height: 1.55;
}
.th-team-side-card__title { font-weight: 600; color: var(--th-ink); margin-bottom: 6px; }
.th-team-side-card__title + div + .th-team-side-card__title { margin-top: 10px; }
.th-team-side-card .th-team-mono { font-size: 11.5px; }
.th-team-former { line-height: 1.5; }
.th-team-former__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--th-line-soft);
}

/* ---------- add member popover ---------- */
.th-team-popover-scrim { position: fixed; inset: 0; z-index: 39; }
.th-team-picker {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: var(--th-paper-sunk);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  box-shadow: 0 12px 36px oklch(20% 0.01 255 / 0.16);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.th-team-picker__search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--th-line);
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--th-ink-2);
}
.th-team-picker__search input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--th-ink);
  flex: 1;
  min-width: 0;
  font-size: var(--th-size-13);
}
.th-team-picker__results { max-height: min(60vh, 340px); overflow-y: auto; }
.th-team-picker__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
  border-bottom: 1px solid var(--th-line-soft);
}
.th-team-picker__option:hover { background: var(--th-paper-2); }
.th-team-picker__option:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; background: var(--th-paper-2); }
.th-team-picker__option:disabled { cursor: progress; opacity: 0.7; }
.th-team-picker .th-avatar { width: 24px; height: 24px; font-size: 10px; }
.th-team-picker__text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.th-team-picker__name { font-size: 13px; color: var(--th-ink); font-weight: 500; overflow-wrap: anywhere; }
.th-team-picker__sub { font-size: 11px; color: var(--th-ink-2); overflow-wrap: anywhere; }
.th-team-picker__note { font-size: 11px; color: var(--th-warn-ink); text-align: right; max-width: 120px; line-height: 1.3; }
.th-team-picker__none { padding: 16px 12px; font-size: var(--th-size-13); color: var(--th-ink-2); line-height: 1.5; }
.th-team-picker__none b { color: var(--th-ink); font-weight: 600; }
.th-team-picker__foot {
  padding: 8px 12px;
  border-top: 1px solid var(--th-line);
  font-size: 11px;
  color: var(--th-ink-2);
  line-height: 1.5;
}
.th-team-picker__status { padding: 8px 12px; font-size: var(--th-size-13); color: var(--th-ink-2); }
.th-team-picker__status .th-team-alert-btn { margin-left: 4px; }
.th-team-picker .th-team-alert { margin: 8px 12px 0; }

/* ---------- references and history tabs ---------- */
.th-team-tab-panel { padding: 16px 24px 28px; display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.th-team-ref-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--th-line-soft);
  flex-wrap: wrap;
}
.th-team-ref-row:last-child { border-bottom: 0; }
.th-team-ref-row__def { font-family: var(--th-font-mono); font-size: 12px; color: var(--th-ink); overflow-wrap: anywhere; }
.th-team-ref-row__role { font-size: var(--th-size-13); color: var(--th-ink-2); }
.th-team-ref-row__version { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); }
.th-team-card-note { padding: 12px 16px; font-size: var(--th-size-13); color: var(--th-ink-2); }
.th-team-page .th-history__row { grid-template-columns: 120px minmax(0, 1fr); }
.th-team-page .th-history__row:last-child { border-bottom: 0; }
.th-team-more { padding: 10px 16px; border-top: 1px solid var(--th-line-soft); }

/* ---------- dialogs (Teams prototype: 560px, 8px radius, deeper scrim) ---------- */
.th-team-page .th-scrim,
.th-team-scrim { background: oklch(20% 0.01 255 / 0.45); padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
.th-team-modal { width: 560px; border-radius: var(--th-radius-8); box-shadow: 0 24px 60px oklch(20% 0.01 255 / 0.3); font-size: var(--th-size-14); max-height: calc(100vh - 24px); }
.th-team-modal .th-input { font-size: var(--th-size-14); }
.th-team-modal__note { font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.th-team-modal__prose { font-size: 13px; color: var(--th-ink-2); line-height: 1.55; }
.th-team-modal__prose b { color: var(--th-ink); font-weight: 600; }
.th-team-box {
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-5);
  background: var(--th-paper);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--th-size-13);
}
.th-team-box__title { font-weight: 600; color: var(--th-ink); }
.th-team-box__row { display: flex; justify-content: space-between; gap: 12px; }
.th-team-box__row .th-team-box__value { font-family: var(--th-font-mono); color: var(--th-ink); }
.th-team-box__note { font-size: 11.5px; color: var(--th-ink-2); }
.th-team-box__title + .th-team-box__note,
.th-team-box__row + .th-team-box__note { border-top: 1px solid var(--th-line-soft); padding-top: 6px; }
.th-team-alert { border-radius: var(--th-radius-5); padding: 10px 12px; font-size: var(--th-size-13); }
.th-team-alert.is-risk { border: 1px solid var(--th-risk); background: var(--th-risk-soft); }
.th-team-alert.is-warn { border: 1px solid var(--th-warn); background: var(--th-warn-soft); color: var(--th-warn-ink); }
.th-team-alert.is-info { border: 1px solid var(--th-advant); background: var(--th-advant-soft); color: var(--th-advant-deep); }
.th-team-alert__title { font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.th-team-alert.is-risk .th-team-alert__title { color: var(--th-risk-ink); margin-bottom: 6px; }
.th-team-alert__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--th-size-13);
  color: var(--th-ink);
  padding: 4px 0;
  flex-wrap: wrap;
}
.th-team-alert__row .th-team-mono { font-size: var(--th-size-13); }
.th-team-alert__role { color: var(--th-ink-2); }
.th-team-alert__note { font-size: 11.5px; color: var(--th-ink-2); margin-top: 6px; }
.th-team-alert .th-team-alert-btn { padding: 1px 8px; margin-left: 4px; }
.th-team-btn-danger,
.th-team-btn-danger:hover { border-color: var(--th-risk); background: var(--th-risk); color: var(--th-paper); }
.th-team-btn-danger:hover { filter: brightness(1.05); }
.th-team-modal .cc-btn { white-space: nowrap; }
/* Disabled primary keeps the production atom's own muted fill; the destructive button keeps reading
   as destructive while disabled (canon: the risk fill at half opacity). */
.th-team-modal .cc-btn.th-team-btn-danger:disabled {
  border-color: var(--th-risk);
  background: var(--th-risk);
  color: var(--th-paper);
  opacity: 0.5;
}

@media (max-width: 720px) {
  .th-team-head-row { flex-direction: column; align-items: stretch; }
  .th-team-page .cc-page-head.th-team-head { flex-direction: column; align-items: stretch; }
  .th-team-facts { flex-direction: column; align-items: stretch; }
  .th-team-fact-sep { display: none; }
  .th-team-modal { width: calc(100vw - 24px); max-width: calc(100vw - 24px); border-radius: var(--th-radius-8); }
}
