.team-gate {
  display: grid;
  gap: 20px;
  width: min(100%, 420px);
  min-width: 0;
  margin: clamp(24px, 8vh, 74px) auto;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.team-gate header { display: grid; gap: 5px; }
.team-gate h1 { font: 500 clamp(27px, 4vw, 38px)/1.05 var(--display-font); letter-spacing: -.025em; }
.team-gate header p { font-size: 13px; line-height: 1.45; }
.team-gate header .eyebrow { color: var(--accent-strong); font-size: 10px; }
.dialog-body > .team-gate { width: min(100%, 450px); margin: 0 auto; border: 0; padding: 2px 0 8px; background: transparent; }

.team-panel, .team-members, .team-member-list, .team-invitations, .team-task-detail, .team-replies, .team-form-stack {
  display: grid;
  gap: 11px;
  min-width: 0;
}
.team-actions, .team-split, .team-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.team-split { justify-content: space-between; }
.team-actions { padding-top: 3px; }
.team-account { padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.team-account > span, .team-person > div { display: grid; gap: 2px; min-width: 0; }
.team-account small, .team-person small, .team-task-meta, .team-task-detail time { color: var(--muted); font-size: 11px; line-height: 1.35; }
.team-account strong, .team-person strong, .team-task-copy strong, .team-hint, .team-task-meta { overflow-wrap: anywhere; }
.team-tabs .button { min-height: 30px; padding: 4px 8px; }
.team-members h3, .team-replies h3 { font-size: 13px; font-weight: 690; }
.team-member-list, .team-invitations { gap: 0; }
.team-invitations { gap: 8px; }
.team-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 2px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.team-person > button { min-height: 27px; padding: 4px 7px; font-size: 11px; }
.team-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.team-intro { padding-block: 7px; }

.team-task-list { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.team-task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.team-task-card:hover { border-color: var(--line-strong); background: var(--accent-bg); }
.team-task-copy { display: grid; gap: 3px; min-width: 0; }
.team-task-copy strong { font-size: 13px; font-weight: 670; }
.team-badge { display: inline-block; padding: 3px 6px; border-radius: 5px; background: #f6ead9; color: #714819; font-size: 10px; font-weight: 680; white-space: nowrap; }
.team-badge--info { background: var(--sky-bg); color: var(--sky); }
.team-badge--done { background: var(--accent-bg); color: var(--accent-strong); }
.team-done { padding-top: 6px; border-top: 1px solid var(--line); }
.team-done summary { width: max-content; max-width: 100%; padding: 4px 0; color: var(--accent-strong); font-size: 12px; font-weight: 670; cursor: pointer; }
.team-done[open] summary { margin-bottom: 6px; }

.team-quote {
  max-height: 140px;
  overflow: auto;
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 6px 6px 0;
  background: var(--accent-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 500 16px/1.4 var(--display-font);
}
.team-task-facts { display: flex; flex-wrap: wrap; gap: 8px 17px; margin: 0; }
.team-task-facts div { min-width: 115px; }
.team-task-facts dt { color: var(--muted); font-size: 11px; }
.team-task-facts dd { margin: 3px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.team-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.team-replies { padding-top: 10px; border-top: 1px solid var(--line); }
.team-replies ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.team-replies li { display: grid; gap: 5px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.team-replies li strong { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.team-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; min-width: 0; }
.team-invite-result #teamInviteLink { font: 11px ui-monospace, monospace; }

@media (max-width: 420px) {
  .team-form-grid { grid-template-columns: 1fr; }
  .team-task-card { padding-inline: 7px; }
}
.app-shell[hidden], #teamGate[hidden], .app-shell button[data-action][hidden] { display: none; }
#teamGate { padding: 0 16px; }
#teamGate .team-setup-back { display: block; margin: -12px auto 20px; }
.screenplay-scene-meta .team-scene-badge { min-height: 22px; padding: 2px 6px; border-color: transparent; background: var(--sky-bg); color: var(--sky); font-size: 10px; }
.screenplay-mode-bar [data-action="team-mark-selected"] { color: var(--accent-strong); background: var(--accent-bg); }
