/* Team Dashboard page. Reuses .kpi-card, .research-modal-*, .btn-* tokens. */

.team-page {
  /* Match the tracker page's padding so the Team tab inherits the same
     horizontal breathing room from the sidebar. */
  padding: 32px 28px;
  /* NOTE: `display: flex` must NOT live on the bare rule — it has the same
     specificity as layout.css's `.page { display: none }` but loads later, so it
     would override the hide and force the Team page visible under every other
     page. Gate the flex display to `.active` instead (see rule below). */
  flex-direction: column;
  gap: 18px;
  width: 100%;
  /* When a group has a logo, team.js populates the whole --team-* set at render
     time; these defaults fall through to the global accents so un-themed (or
     pre-logo) groups still render correctly.

     Rules below should reference --team-accent, never --team-primary:
     --team-primary is the *raw* color sampled from the logo and carries no
     contrast guarantee, while --team-accent is the same color after the
     derivation nudged it to clear 4.5:1 against the page surface. */
  --team-primary:      var(--gold);
  --team-secondary:    var(--green);
  --team-accent:       var(--gold);
  --team-accent-hover: var(--gold-hover);
  --team-on-accent:    #ffffff;
}

/* Show the Team page's flex column only when it's the active page. Specificity
   (0,3,0) beats layout.css's `.page.active { display: block }` (0,2,0), so the
   page lays out as a flex column when shown and stays hidden otherwise. */
.page.team-page.active { display: flex; }

/* Page-wide brand takeover.
   When a group has a logo, team.js derives a full readable palette from it
   (src/js/utils/theme-derive.js) and writes every --team-* token inline on
   .team-page. Rebinding the *global* tokens from them here is the whole trick:
   every .team-* rule below — plus the shared .kpi-card / .btn-* rules — already
   reads --bg/--surface/--text, so this single block re-skins the entire page
   without touching another selector.

   Contrast is guaranteed upstream: the derivation enforces 7:1 for body text
   and 4.5:1 for the accent, and picks light-vs-dark ink from the *base theme's*
   mode, so a near-black or neon logo can't produce an unreadable page. */
.team-page[data-themed="1"] {
  --bg:           var(--team-bg);
  --bg-warm:      var(--team-bg-warm);
  --surface:      var(--team-surface);
  --border:       var(--team-border);
  --border-light: var(--team-border-light);
  --text:         var(--team-text);
  --text-muted:   var(--team-text-muted);
  --text-dim:     var(--team-text-dim);

  /* Accent-colored chrome (buttons, badges, focus rings) follows the brand. */
  --gold:         var(--team-accent);
  --gold-hover:   var(--team-accent-hover);
  --gold-soft:    color-mix(in srgb, var(--team-accent) 12%, transparent);

  background: var(--team-bg);
  color: var(--text);
  min-height: 100%;
}

/* The accent is already contrast-checked against --surface, so a plain
   accent-colored top edge reads cleanly on every logo. */
.team-page[data-themed="1"] .kpi-card {
  border-top: 3px solid var(--team-accent);
}
.team-page[data-themed="1"] .team-lb-col-header {
  background: var(--team-accent);
  color: var(--team-on-accent);
}

/* ── Header (tabs + period) ────────────────────────────────────────────── */

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

/* An agent can belong to any number of groups, so the strip scrolls sideways
   rather than wrapping or squashing tabs. max-width keeps it from shoving the
   period controls off the row — .team-header wraps below that. */
.team-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-warm);
  border-radius: 8px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.team-tabs::-webkit-scrollbar { display: none; }

.team-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--speed);
  max-width: 240px;
  flex-shrink: 0;
}
.team-tab:hover { color: var(--text); }
.team-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(var(--shadow-rgb),0.08);
}
.team-tab.active.team-tab-themed {
  /* Inverted: primary color is the background, text rides on top in white.
     The visual association between agency logo and tab is unmistakable. */
  background: var(--team-accent);
  color: var(--team-on-accent);
  box-shadow: 0 1px 4px rgba(var(--shadow-rgb),0.16);
}
.team-tab.active.team-tab-themed .team-tab-logo {
  background: rgba(255, 255, 255, 0.2);
}
.team-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-tab-logo {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-warm);
}
.team-tab-logo img { width: 100%; height: 100%; object-fit: cover; }
.team-tab-logo[hidden] { display: none; }

/* Trailing ＋ on the tab strip. Sized to match a tab's height so the strip
   keeps one baseline however many groups are in it. */
.team-tab-add {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  font-family: var(--font-body);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--speed);
}
.team-tab-add:hover {
  background: var(--surface);
  color: var(--text);
}

.team-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--team-on-accent);
  background: var(--gold);
  border-radius: 9px;
}

.team-period {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Export sits to the left of the Period control, separated by a hairline so it
   reads as its own action rather than part of the period group. */
.team-export-report {
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  border-radius: 6px;
}
.team-export-report:disabled {
  opacity: 0.45;
  cursor: default;
}
.team-export-report:disabled:hover {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.team-period-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.team-period-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
}

/* When the user has a group, the Team nav icon shows the agency logo
   instead of the default emoji. inline-block + vertical-align:middle
   mirrors how the emoji is laid out so the .nav-icon container (text-
   align: center, width: 20px) centers the image the same way it would
   center the emoji glyph. */
.nav-icon-logo {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
}

/* Two agencies (created + joined) → both logos staggered diagonally inside the
   32px .nav-icon slot. The wrapper is sized so the flex parent still centers it,
   and the two logos overlap ~40% so both stay fully visible without clipping. */
.nav-icon-logos {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 28px;
  vertical-align: middle;
}
.nav-icon-logos .nav-icon-logo {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 3px;
}
/* Created ("My Team") logo sits behind, top-left. */
.nav-icon-logos .nav-icon-logo--back {
  top: 0;
  left: 0;
  z-index: 1;
}
/* Joined logo sits in front, bottom-right, with a ring in the sidebar bg so the
   two tiles read as distinct overlapping logos. */
.nav-icon-logos .nav-icon-logo--front {
  bottom: 0;
  right: 0;
  z-index: 2;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Sidebar badge (cross-tab pending count) — scope position:relative to
   nav items that actually carry a badge so we don't disturb the rest. */
.nav-item:has(.nav-badge:not([hidden])) { position: relative; }
.nav-item .nav-badge[hidden] { display: none; }
.nav-item .nav-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: var(--gold);
  border-radius: 8px;
}

/* ── Loading / errors / empty ──────────────────────────────────────────── */

.team-loading,
.team-find-loading,
.team-find-empty,
.team-leaderboard-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
}

.team-error,
.team-form-error,
.team-find-error {
  padding: 12px 14px;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-body);
}

.team-empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
}
.team-empty-icon { font-size: 36px; margin-bottom: 12px; }
.team-empty h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text);
}
.team-empty p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
}
.team-empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.team-pending-self {
  margin-top: 24px;
  text-align: left;
  background: var(--bg-warm);
  border-radius: 8px;
  padding: 14px 16px;
}
.team-pending-self h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* ── Group header ──────────────────────────────────────────────────────── */

.team-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* Subtle theme tint on the left edge — visible only when a logo is set
     (otherwise --team-primary equals --gold, which already matches). */
  border-left: 4px solid var(--team-accent);
}
.team-group-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.team-group-logo {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--bg-warm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.team-group-logo img { width: 100%; height: 100%; object-fit: cover; }
.team-group-logo-fallback {
  background: linear-gradient(135deg, var(--team-accent), var(--team-secondary));
}
.team-group-logo-fallback span {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: white;
}
.team-group-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
}
.team-group-desc {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
}
.team-group-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-dim);
}
.team-meta-sep { color: var(--text-dim); }
.team-invite-code {
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.05em;
}
.team-private-tag {
  padding: 2px 6px;
  background: var(--sand-soft);
  color: var(--wood);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.team-group-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex-shrink: 0;
  min-width: 110px;
}
.team-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--speed);
  text-align: center;
  white-space: nowrap;
}
.team-action-btn:hover {
  background: var(--bg-warm);
  color: var(--text);
  border-color: var(--team-accent);
}
.team-action-btn.is-danger {
  color: var(--red);
  border-color: var(--red-soft);
}
.team-action-btn.is-danger:hover {
  background: var(--red-soft);
}

/* ── Section titles ────────────────────────────────────────────────────── */

.team-section-title {
  margin: 18px 0 8px;
  font-family: var(--font-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 700;
}

.team-pending-count {
  display: inline-block;
  background: var(--gold);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 6px;
  letter-spacing: 0.02em;
}

/* Team stat cards row */
.team-stat-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Caption under a KPI value — carries the denominator for derived numbers
   ("over 14 business days") so the figure is auditable at a glance. */
.kpi-sub {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ── My Contribution card ──────────────────────────────────────────────── */

.team-my-contrib {
  display: flex;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--team-accent) 14%, transparent),
    var(--bg-warm));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 22px;
}
.team-my-contrib-rank {
  flex-shrink: 0;
  padding-right: 24px;
  border-right: 1px solid var(--border-light);
}
.team-my-contrib-rank-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.team-my-contrib-rank-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--team-accent);
  font-family: var(--font-body);
}
.team-my-contrib-rank-total {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.team-my-contrib-rank-by {
  font-size: 11px;
  color: var(--text-muted);
}
.team-my-contrib-stats {
  display: flex;
  gap: 28px;
  flex: 1;
}
.team-my-contrib-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.team-my-contrib-stats span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.team-my-contrib-stats strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ── Leaderboard ──────────────────────────────────────────────────────── */

.team-leaderboards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .team-leaderboards { grid-template-columns: 1fr; }
}
.team-leaderboard-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.team-lb-col-header {
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-light);
}
.team-lb-col-list {
  display: flex;
  flex-direction: column;
}
.team-lb-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: default;
  transition: background var(--speed);
}
.team-lb-item:last-child { border-bottom: 0; }
.team-lb-item.is-clickable { cursor: pointer; }
.team-lb-item.is-clickable:hover { background: var(--bg-warm); }
.team-lb-item.is-self {
  background: color-mix(in srgb, var(--team-accent) 12%, transparent);
}
.team-lb-rank {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
}
.team-lb-body {
  min-width: 0;
}
.team-lb-name {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-lb-subteam {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-lb-value {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--team-accent);
  text-align: right;
}

/* ── Pending requests ──────────────────────────────────────────────────── */

.team-pending-list,
.team-roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-pending-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--sand-soft);
  border-radius: 8px;
  font-family: var(--font-body);
}
.team-pending-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.team-pending-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.team-pending-actions {
  display: flex;
  gap: 6px;
}

/* ── Roster ────────────────────────────────────────────────────────────── */

.team-roster-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: var(--font-body);
  transition: all var(--speed);
}
.team-roster-row.is-clickable {
  cursor: pointer;
}
.team-roster-row.is-clickable:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.team-roster-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.team-roster-you {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}
.team-roster-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.team-roster-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
}
.team-roster-ap { font-weight: 700; color: var(--text); }
.team-roster-fam { color: var(--text-muted); }
.team-roster-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-warm);
  color: var(--text-muted);
}
.team-role-badge.is-admin {
  background: var(--gold-soft);
  color: var(--gold);
}
.team-row-menu {
  background: transparent;
  border: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
}
.team-row-menu:hover { background: var(--bg-warm); }

.team-row-menu-popover {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(var(--shadow-rgb),0.18);
  padding: 4px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  min-width: 180px;
}
.team-row-menu-popover button {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
}
.team-row-menu-popover button:hover { background: var(--bg-warm); }
.team-row-menu-popover button.is-danger { color: var(--red); }
.team-row-menu-popover button.is-danger:hover { background: var(--red-soft); }

/* ── Deletion banner ──────────────────────────────────────────────────── */

.team-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--sand-soft);
  border: 1px solid var(--sand);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
}
.team-banner-dismiss {
  background: transparent;
  border: 0;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
}

/* ── Modals ────────────────────────────────────────────────────────────── */

#group-create-modal-root,
#group-find-modal-root,
#member-detail-modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-modal-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
}
.team-modal-sub {
  margin: 0 0 16px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
}

.team-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.team-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-body);
}
.team-field span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.team-field input[type="text"],
.team-field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  resize: vertical;
}
.team-field input[type="text"]:focus,
.team-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.team-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.team-field-checkbox span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.team-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.team-invite-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-warm);
  border-radius: 8px;
}
.team-invite-display code {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1em;
}

/* Find modal */
.team-find-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-warm);
  border-radius: 8px;
  margin-bottom: 12px;
}
.team-find-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
}
.team-find-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(var(--shadow-rgb),0.06);
}
.team-find-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.team-find-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 13px;
}
.team-find-input:focus {
  outline: none;
  border-color: var(--gold);
}
.team-find-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.team-find-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-warm);
  border-radius: 8px;
}
.team-find-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.team-find-result-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.team-find-result-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Search hits the user is already a member of — inert, not a button. */
.team-find-joined {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-warm);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Logo picker (used in create + edit modals) ───────────────────────── */

.team-logo-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}
.team-logo-preview {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.team-logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.team-logo-placeholder {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-dim);
}
.team-logo-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.team-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  font-family: var(--font-body);
}
.team-logo-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.team-logo-upload-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.team-logo-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-body);
}
.team-logo-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.team-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}
.team-logo-swatch-label {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-body);
}

/* Mobile-ish */
@media (max-width: 720px) {
  .team-page { padding: 12px 14px 24px; }
  .team-my-contrib { flex-direction: column; align-items: flex-start; gap: 14px; }
  .team-my-contrib-rank { padding-right: 0; border-right: 0; }
  .team-my-contrib-stats { gap: 18px; flex-wrap: wrap; }
  .team-group-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
}
