﻿/* ============================================================
   AI Team Page — Krispey Design System
   ============================================================ */

/* --- Header -------------------------------------------------- */
.ai-team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

/* --- Status Strip -------------------------------------------- */
.ai-team-status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.ai-team-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  transition: border-color .22s cubic-bezier(.22,1,.36,1),
              box-shadow .22s cubic-bezier(.22,1,.36,1);
}

.ai-team-stat:hover {
  border-color: rgba(167,139,250,.25);
  box-shadow: 0 8px 32px rgba(0,0,0,.3), 0 0 20px var(--purple-deep-glow);
}

.ai-team-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(167,139,250,.08);
  border: 1px solid rgba(167,139,250,.15);
  color: var(--purple-bright);
}

.ai-team-stat-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ai-team-stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ai-team-stat-label {
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .02em;
}

.ai-team-stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Workspace Layout ---------------------------------------- */
.ai-team-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* --- Team Room (Left Panel) ---------------------------------- */
.ai-team-room {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --- Textarea ------------------------------------------------ */
.ai-team-textarea {
  width: 100%;
  min-height: 100px;
  max-height: 300px;
  padding: 14px 16px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-main);
  font-size: .85rem;
  line-height: 1.55;
  resize: none;
  outline: none;
  transition: border-color .22s cubic-bezier(.22,1,.36,1),
              box-shadow .22s cubic-bezier(.22,1,.36,1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(167,139,250,.25) transparent;
}

.ai-team-textarea::-webkit-scrollbar { width: 5px; }
.ai-team-textarea::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
.ai-team-textarea::-webkit-scrollbar-thumb { background: rgba(167,139,250,.3); border-radius: 10px; }
.ai-team-textarea::-webkit-scrollbar-thumb:hover { background: rgba(167,139,250,.5); }

.ai-team-textarea:focus {
  border-color: rgba(167,139,250,.45);
  box-shadow: 0 0 0 3px rgba(139,92,246,.08);
}

.ai-team-textarea::placeholder {
  color: rgba(255,255,255,.25);
}

/* --- Quick Actions ------------------------------------------- */
.ai-team-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-team-quick-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 100px;
  background: rgba(255,255,255,.03);
  color: var(--dim);
  font-family: var(--font-main);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s cubic-bezier(.22,1,.36,1);
  user-select: none;
  white-space: nowrap;
}

.ai-team-quick-btn:hover {
  border-color: rgba(167,139,250,.3);
  color: #fff;
  background: rgba(167,139,250,.08);
}

.ai-team-quick-btn.active {
  background: rgba(167,139,250,.15);
  border-color: rgba(167,139,250,.35);
  color: var(--purple-bright);
}

/* --- Controls ------------------------------------------------ */
.ai-team-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-team-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-team-control-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--dim);
}

/* --- Toggle Switch ------------------------------------------- */
.ai-team-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.ai-team-toggle input { display: none; }

.ai-team-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.08);
  border-radius: 100px;
  cursor: pointer;
  transition: background .2s cubic-bezier(.22,1,.36,1);
}

.ai-team-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--muted);
  border-radius: 50%;
  transition: all .2s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}

.ai-team-toggle input:checked + .ai-team-toggle-track {
  background: rgba(167,139,250,.3);
}

.ai-team-toggle input:checked + .ai-team-toggle-track .ai-team-toggle-thumb {
  transform: translateX(18px);
  background: var(--purple-bright);
}

/* --- Agent Pills --------------------------------------------- */
.ai-team-agent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-team-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 100px;
  background: rgba(255,255,255,.03);
  color: var(--dim);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s cubic-bezier(.22,1,.36,1);
  user-select: none;
}

.ai-team-agent-pill:hover {
  border-color: rgba(167,139,250,.3);
  color: var(--text);
}

.ai-team-agent-pill.selected {
  background: rgba(167,139,250,.15);
  border-color: rgba(167,139,250,.35);
  color: var(--purple-bright);
}

.ai-team-agent-pill.paused {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  color: var(--muted);
  opacity: .6;
}

/* --- Cost Row ------------------------------------------------ */
.ai-team-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-team-cost-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}

/* --- Start Button ------------------------------------------- */
.ai-team-start-btn {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple-bright), var(--purple));
  color: #07070a;
  font-family: var(--font-main);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow .22s cubic-bezier(.22,1,.36,1),
              filter .22s cubic-bezier(.22,1,.36,1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 0 var(--purple-dark),
              0 6px 18px rgba(139,92,246,.25);
}

.ai-team-start-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 0 var(--purple-dark),
              0 8px 24px rgba(139,92,246,.35);
}

.ai-team-start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--purple-dark);
}

.ai-team-start-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  filter: none;
}

.ai-team-start-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Activity Panel (Right) ---------------------------------- */
.ai-team-activity {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-team-activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.ai-team-activity-header h3 {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
}

.ai-team-activity-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.ai-team-activity-body::-webkit-scrollbar { width: 5px; }
.ai-team-activity-body::-webkit-scrollbar-track { background: transparent; }
.ai-team-activity-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }

/* --- Empty State --------------------------------------------- */
.ai-team-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}

.ai-team-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(167,139,250,.08);
  border: 1px solid rgba(167,139,250,.15);
  color: var(--purple-bright);
  margin-bottom: 16px;
}

.ai-team-empty-icon svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.ai-team-empty-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.ai-team-empty-desc {
  font-size: .82rem;
  color: var(--dim);
  max-width: 320px;
  line-height: 1.5;
}

/* --- Timeline ------------------------------------------------ */
.ai-timeline {
  display: flex;
  flex-direction: column;
}

.ai-timeline-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.ai-timeline-item:last-child {
  border-bottom: none;
}

.ai-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.ai-timeline-dot.plan {
  background: var(--purple-bright);
  box-shadow: 0 0 8px rgba(167,139,250,.4);
}

.ai-timeline-dot.work {
  background: #60a5fa;
  box-shadow: 0 0 8px rgba(96,165,250,.4);
}

.ai-timeline-dot.review {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251,191,36,.4);
}

.ai-timeline-dot.result {
  background: var(--mint);
  box-shadow: 0 0 8px rgba(52,211,153,.4);
}

.ai-timeline-content {
  flex: 1;
  min-width: 0;
}

.ai-timeline-agent {
  font-size: .72rem;
  font-weight: 600;
  color: var(--purple-bright);
  margin-bottom: 2px;
}

.ai-timeline-msg {
  font-size: .8rem;
  color: var(--dim);
  line-height: 1.5;
}

.ai-timeline-time {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--muted);
  margin-top: 4px;
}

/* --- Result Box ---------------------------------------------- */
.ai-team-result-box {
  background: rgba(52,211,153,.06);
  border: 1px solid rgba(52,211,153,.2);
  border-radius: 14px;
  padding: 20px;
}

.ai-team-result-box h4 {
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.ai-team-result-box p {
  font-size: .8rem;
  color: var(--dim);
  line-height: 1.5;
}

.ai-team-result-content {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.65;
}

.ai-team-result-content p {
  font-size: .85rem;
  color: var(--text);
  margin-bottom: 10px;
}

.ai-team-result-content h2,
.ai-team-result-content h3,
.ai-team-result-content h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 8px;
}

.ai-team-result-content h2 { font-size: 1rem; }
.ai-team-result-content h3 { font-size: .92rem; }
.ai-team-result-content h4 { font-size: .85rem; }

.ai-team-result-content strong {
  color: #fff;
  font-weight: 700;
}

.ai-team-result-content em {
  color: var(--dim);
  font-style: italic;
}

.ai-team-result-content ol.ai-md-list,
.ai-team-result-content ul.ai-md-list {
  padding-left: 20px;
  margin: 8px 0;
}

.ai-team-result-content li.ai-md-ol,
.ai-team-result-content li.ai-md-ul {
  margin-bottom: 4px;
  line-height: 1.55;
  color: var(--text);
}

.ai-team-result-content .ai-md-code-block {
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: .75rem;
  line-height: 1.5;
  color: var(--text);
}

.ai-team-result-content .ai-md-inline-code {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: .8em;
  color: var(--purple-bright);
}

.ai-team-result-content .ai-md-quote {
  border-left: 3px solid rgba(167,139,250,.4);
  padding-left: 12px;
  margin: 10px 0;
  color: var(--dim);
  font-style: italic;
}

.ai-team-result-content .ai-md-link {
  color: var(--purple-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(167,139,250,.3);
  transition: border-color .15s;
}

.ai-team-result-content .ai-md-link:hover {
  border-bottom-color: var(--purple-bright);
}

.ai-team-contributions {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ai-team-contributions-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  color: var(--dim);
  transition: background .15s;
}

.ai-team-contributions-toggle:hover {
  background: rgba(255,255,255,.03);
}

.ai-team-contributions-toggle svg {
  transition: transform .2s;
}

.ai-team-contributions.open .ai-team-contributions-toggle svg {
  transform: rotate(180deg);
}

.ai-team-contributions-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}

.ai-team-contributions.open .ai-team-contributions-list {
  max-height: 400px;
}

.ai-team-contrib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: .78rem;
}

.ai-team-contrib-name {
  font-weight: 600;
  color: var(--text);
}

.ai-team-contrib-role {
  color: var(--muted);
}

/* --- Section ------------------------------------------------- */
.ai-team-section {
  margin-bottom: 24px;
}

.ai-team-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ai-team-section-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.ai-team-agent-count {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  color: var(--purple-bright);
  background: rgba(167,139,250,.1);
  padding: 3px 10px;
  border-radius: 100px;
}

/* --- Agents Grid --------------------------------------------- */
.ai-team-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* --- Agent Card ---------------------------------------------- */
.ai-team-agent-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  transition: all .22s cubic-bezier(.22,1,.36,1);
  cursor: pointer;
}

.ai-team-agent-card:hover {
  border-color: rgba(167,139,250,.25);
  box-shadow: 0 8px 32px rgba(0,0,0,.3),
              0 0 20px var(--purple-deep-glow);
  transform: translateY(-2px);
}

.ai-team-agent-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(167,139,250,.08);
  border: 1px solid rgba(167,139,250,.2);
  color: var(--purple-bright);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.ai-team-agent-avatar-lg img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.ai-team-agent-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-team-agent-name {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-team-agent-role {
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.ai-team-agent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--muted);
}

.ai-team-agent-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-team-agent-meta .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  flex-shrink: 0;
}

.ai-team-agent-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
}

.ai-team-agent-actions button {
  flex: 1;
  padding: 7px 12px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s cubic-bezier(.22,1,.36,1);
}

.ai-team-agent-actions .btn-agent-primary {
  background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.25);
  color: var(--purple-bright);
}

.ai-team-agent-actions .btn-agent-primary:hover {
  background: rgba(167,139,250,.2);
  border-color: rgba(167,139,250,.45);
}

.ai-team-agent-actions .btn-agent-secondary {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-light);
  color: var(--dim);
}

.ai-team-agent-actions .btn-agent-secondary:hover {
  background: rgba(255,255,255,.08);
  color: var(--text);
}

/* --- Hire Modal ---------------------------------------------- */
.ai-team-hire-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4,4,8,.6);
  backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
}

.ai-team-hire-modal.open {
  display: flex;
}

.ai-team-hire-panel {
  width: clamp(420px, 42vw, 560px);
  max-width: 92vw;
  max-height: calc(100dvh - 32px);
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0,0,0,.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ai-team-hire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.ai-team-hire-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.ai-team-hire-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.ai-team-hire-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--text);
}

.ai-team-hire-close svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ai-team-hire-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-team-hire-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ai-team-hire-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.ai-team-hire-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ai-team-hire-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(167,139,250,.1);
  border: 1px solid rgba(167,139,250,.2);
  color: var(--purple-bright);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.ai-team-hire-preview-name {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.ai-team-hire-preview-role {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 2px;
}

.ai-team-hire-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-team-hire-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 2px;
}

/* --- Emoji Picker -------------------------------------------- */
.ai-team-emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ai-team-emoji-picker button {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background .15s, transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-team-emoji-picker button:hover {
  background: rgba(255,255,255,.06);
  transform: scale(1.15);
}

.ai-team-emoji-picker button.selected {
  background: rgba(167,139,250,.15);
  border: 1px solid rgba(167,139,250,.3);
}

/* --- Pulse Animation ----------------------------------------- */
@keyframes pulse {
  0%, 80%, 100% { opacity: .3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* --- Runs Drawer ------------------------------------------------ */
.ai-team-runs-drawer {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
}

.ai-team-runs-drawer.open {
  pointer-events: auto;
}

.ai-team-runs-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,4,8,.6);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .28s cubic-bezier(.22,1,.36,1);
}

.ai-team-runs-drawer.open .ai-team-runs-drawer-backdrop {
  opacity: 1;
}

.ai-team-runs-drawer-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  transform: translateX(24px);
  opacity: 0;
  transition: transform .28s cubic-bezier(.22,1,.36,1), opacity .28s cubic-bezier(.22,1,.36,1);
  overflow: hidden;
}

.ai-team-runs-drawer.open .ai-team-runs-drawer-panel {
  transform: translateX(0);
  opacity: 1;
}

.ai-team-runs-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-team-runs-drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.ai-team-runs-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.ai-team-runs-drawer-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--text);
}

.ai-team-runs-drawer-close svg {
  width: 16px;
  height: 16px;
}

.ai-team-runs-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.ai-team-runs-drawer-body::-webkit-scrollbar { width: 5px; }
.ai-team-runs-drawer-body::-webkit-scrollbar-track { background: transparent; }
.ai-team-runs-drawer-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }

.ai-team-runs-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.ai-team-runs-item:hover {
  border-color: rgba(167,139,250,.3);
  background: rgba(255,255,255,.02);
}

.ai-team-runs-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ai-team-runs-item-task {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-team-runs-item-status {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
}

.status-completed { background: rgba(52,211,153,.1); color: #34d399; }
.status-failed { background: rgba(248,113,113,.1); color: #f87171; }
.status-planning, .status-working, .status-reviewing { background: rgba(167,139,250,.1); color: var(--purple-bright); }

.ai-team-runs-item-meta {
  font-size: .72rem;
  color: var(--muted);
}

.ai-team-runs-detail {
  padding: 8px 0;
}

.ai-team-runs-detail-row {
  font-size: .82rem;
  color: var(--text);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.ai-team-runs-detail-label {
  font-weight: 600;
  color: var(--dim);
  margin-right: 8px;
}

.ai-team-runs-detail-section {
  margin-top: 16px;
}

.ai-team-runs-detail-section > .ai-team-runs-detail-label {
  display: block;
  margin-bottom: 10px;
  font-size: .78rem;
}

/* --- Hire Modal Smooth Scroll ----------------------------------- */
.ai-team-hire-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ai-team-hire-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* --- Responsive (max-width: 900px) --------------------------- */
@media(max-width:900px) {
  .ai-team-status-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .ai-team-workspace {
    grid-template-columns: 1fr;
  }

  .ai-team-emoji-picker {
    grid-template-columns: repeat(6, 1fr);
  }

  .ai-team-agents-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}
