/* Team brands (js/team-brands.js): the team list, its picker and "who has it" dialogs,
   the editor's quiet "Find a brand from your team" row and pane, and a team brand's
   read-only settings. Tokens only. */

/* ---------------------------------------------------------------- team list --- */

.tb-tools {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-sm);
}
.tb-tools .brand-search { flex: 1 1 240px; max-width: 380px; margin: 0; }
.tb-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.tb-filter select { width: auto; height: 36px; padding: 0 30px 0 10px; font-size: var(--text-sm); }
.tb-seg {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--surface-wash);
}
.tb-seg button {
  padding: 5px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  cursor: pointer;
}
.tb-seg button[aria-pressed="true"] {
  background: var(--surface-white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.tb-seg-n:not(:empty) { margin-left: 4px; color: var(--text-tertiary); font-weight: var(--weight-medium); }

.tb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--spacing-xs) var(--spacing-sm);
  align-content: start;
  max-height: 420px;
  overflow-y: auto;
  padding: 2px;
}
.tb-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-white);
}
.tb-row:hover { border-color: var(--border-strong); background: var(--surface-canvas); }
.tb-row .td-brand-body { flex: 1; min-width: 0; }
.tb-row .td-brand-name {
  display: block;
  overflow: hidden;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-left { color: var(--text-quaternary); }
.tb-act { flex: none; }
.tb-onlist {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--success);
  white-space: nowrap;
  cursor: pointer;
}
.tb-onlist .tb-a { display: inline-flex; align-items: center; gap: 4px; }
.tb-onlist .tb-b { display: none; }
.tb-onlist:hover, .tb-onlist:focus-visible { color: var(--danger); background: var(--danger-wash); }
.tb-onlist:hover .tb-a, .tb-onlist:focus-visible .tb-a { display: none; }
.tb-onlist:hover .tb-b, .tb-onlist:focus-visible .tb-b { display: inline; }
.tb-yours { padding: 5px 8px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-tertiary); }
.tb-people {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  white-space: nowrap;
  cursor: pointer;
}
.tb-people:hover, .tb-people:focus-visible { background: var(--surface-wash); color: var(--text-primary); }
.tb-empty {
  grid-column: 1 / -1;
  padding: var(--spacing-lg) 0;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-align: center;
}

/* Team page Brands tab: heading row with the owner/admin setting beside it. */
.tb-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-md);
}
.tb-card-head .td-muted { margin: 4px 0 0; max-width: 560px; }
.tb-count { margin-left: 6px; color: var(--text-tertiary); font-weight: var(--weight-medium); }
.tb-setting { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tb-setting-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-tertiary); }
.tb-setting .tb-seg { margin-left: 0; }
.tb-ask {
  margin: 0 0 var(--spacing-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ dialogs --- */

.tb-modal {
  position: fixed;
  inset: 0;
  z-index: 2050; /* under .es-confirm-modal (2100), so a confirm can open on top */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}
.tb-modal-backdrop { position: absolute; inset: 0; background: var(--overlay-scrim); }
.tb-modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 460px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  padding: var(--spacing-lg);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xl);
}
.tb-modal-card--wide { width: 720px; }
.tb-modal-card h3 {
  margin: 0;
  padding-right: 36px;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.tb-modal-sub { margin: 4px 0 var(--spacing-md); font-size: var(--text-sm); color: var(--text-secondary); }
.tb-modal-body { min-height: 0; overflow: auto; }
.tb-modal-body .tb-list { max-height: 400px; }
.tb-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font-size: var(--text-xl);
  color: var(--text-tertiary);
  cursor: pointer;
}
.tb-modal-close:hover { background: var(--surface-wash); color: var(--text-primary); }
.tb-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.tb-people-list { display: flex; flex-direction: column; gap: 2px; }
.tb-person {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
}
.tb-person:hover { background: var(--surface-wash); }
.tb-person input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.tb-person-name { flex: 1; min-width: 0; }
.tb-person-note { font-size: var(--text-xs); color: var(--text-tertiary); }

/* ----------------------------------------------------- sidebar + get set up --- */

.shell-brand-link .tb-ico { display: inline-flex; flex: none; margin-left: auto; padding-right: 4px; color: var(--text-quaternary); }
.shell-brand-link .tb-ico + .shell-brand-count { margin-left: 4px; }
.shell-brand-link.is-add.tb-team-add .shell-brand-mark { color: var(--text-tertiary); }
.shell-brand-link.is-add.tb-team-add .shell-brand-mark svg { width: 14px; height: 14px; }
.shell-brand-link.is-add.tb-nudge,
.shell-brand-link.is-add.tb-nudge .shell-brand-mark { color: var(--primary-text); }

.tb-gs-actions { display: flex; flex: none; align-items: center; gap: var(--spacing-sm); margin-left: auto; }
.tb-linkbtn {
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  cursor: pointer;
}
.tb-linkbtn:hover { background: var(--surface-wash); color: var(--primary-text); }

/* -------------------------------------------------------------- editor menu --- */

/* A quiet last row: tertiary text, no icon block, no section. */
.tb-find {
  margin-top: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  cursor: pointer;
}
.tb-find:hover, .tb-find:focus-visible { background: var(--surface-wash); color: var(--text-secondary); outline: none; }
.brand-item .tb-ico { display: inline-flex; flex: none; margin-left: 2px; color: var(--text-quaternary); }
.tb-pane[hidden] { display: none; }
.tb-pane-head { display: flex; align-items: center; gap: 6px; padding: 2px 2px 4px; }
.tb-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.tb-back:hover { background: var(--surface-wash); color: var(--text-primary); }
.tb-pane-title {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.tb-pane-list { max-height: 228px; overflow-y: auto; }
.tb-pane-item.is-busy { opacity: 0.5; pointer-events: none; }
.tb-by { flex: none; margin-left: auto; font-size: var(--text-2xs); color: var(--text-tertiary); }
.tb-pane-note { padding: 6px 10px 2px; font-size: var(--text-2xs); color: var(--text-tertiary); }

/* ------------------------------------------------- a team brand's settings --- */

.tb-brand-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
  padding: 12px 14px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--surface-canvas);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}
.tb-brand-note svg { flex: none; margin-top: 3px; color: var(--text-tertiary); }
.tb-brand-note strong { font-weight: var(--weight-semibold); color: var(--text-primary); }
[data-team-locked] input,
[data-team-locked] textarea {
  background: var(--surface-canvas) !important;
  color: var(--text-secondary) !important;
  pointer-events: none;
}
[data-team-locked] button,
[data-team-locked] .brand-link-row.is-ghost,
[data-team-locked] #brand-uc-add-btn { display: none !important; }
