/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:      #080b12;
  --bg2:     #0c1020;
  --surf:    #0f1525;
  --surf2:   #141c30;
  --surf3:   #1a2340;

  /* Borders */
  --border:  #1e2a42;
  --border2: #243050;

  /* Text */
  --text:    #dde3f5;
  --muted:   #4a5580;
  --muted2:  #303a58;

  /* Role accent colors */
  --lead:     #f59e0b;
  --arch:     #8b5cf6;
  --backend:  #3b82f6;
  --frontend: #ec4899;
  --ml:       #06b6d4;
  --devops:   #10b981;
  --qa:       #ef4444;
  --pm:       #f97316;

  /* Pipeline stage colors */
  --s0: #6366f1;
  --s1: #3b82f6;
  --s2: #8b5cf6;
  --s3: #10b981;
  --s4: #f59e0b;
  --s5: #06b6d4;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBARS
═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--border2); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════════ */
.topbar {
  height: 52px;
  background: var(--surf);
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 200;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  letter-spacing: -0.3px;
  padding-right: 16px;
  border-right: 1px solid var(--border2);
  flex-shrink: 0;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--s0) 0%, var(--s2) 100%);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 2px;
}

.nav-item {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  background: none;
  border: none;
}

.nav-item:hover          { color: var(--text); background: var(--surf2); }
.nav-item.active         { color: var(--text); background: var(--surf2); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tbtn {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surf2);
  color: var(--muted);
  transition: all 0.15s;
  white-space: nowrap;
}

.tbtn:hover      { color: var(--text); background: var(--surf3); }
.tbtn.cta        { background: var(--s0); border-color: var(--s0); color: #fff; }
.tbtn.cta:hover  { background: #4f52d8; }

/* ═══════════════════════════════════════════════════════════
   VIEWS
═══════════════════════════════════════════════════════════ */
.view        { display: none; flex: 1; overflow: hidden; }
.view.active { display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════════════
   TEAM VIEW — LAYOUT
═══════════════════════════════════════════════════════════ */
.team-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.team-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surf);
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  border-bottom: 1px solid var(--border);
}

.sidebar-section-head {
  padding: 14px 16px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-count {
  background: var(--surf3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 1px 7px;
  font-size: 10px;
  font-family: 'Geist Mono', monospace;
  color: var(--muted);
}

.agent-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.agent-sidebar-item:hover         { background: var(--surf2); }
.agent-sidebar-item.active        { background: var(--surf2); border-left-color: currentColor; }

.asi-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.asi-info   { flex: 1; min-width: 0; }
.asi-name   { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asi-role   { font-size: 11px; color: var(--muted); font-family: 'Geist Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.asi-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Agent Detail Pane ────────────────────────────────────── */
.agent-detail {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 900px;
}

.agent-hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.agent-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 36px;
  flex-shrink: 0;
  position: relative;
}

.agent-hero-avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  border: 2px solid currentColor;
  opacity: 0.3;
}

.agent-hero-body           { flex: 1; }
.agent-hero-name           { font-family: 'Instrument Serif', serif; font-size: 28px; margin-bottom: 4px; line-height: 1.2; }
.agent-hero-title          { font-size: 13px; color: var(--muted); font-family: 'Geist Mono', monospace; margin-bottom: 10px; }

.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Geist Mono', monospace;
  letter-spacing: 0.3px;
}

.agent-hero-actions {
  display: flex;
  gap: 8px;
  flex-direction: column;
  align-items: flex-end;
}

/* ── Section Cards ─────────────────────────────────────────── */
.section-card {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.sc-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sc-head-icon  { font-size: 16px; }
.sc-head-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

.sc-body { padding: 16px 18px; }

/* ── Services Grid ─────────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.service-chip {
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  transition: all 0.15s;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 7px;
}

.service-chip:hover { border-color: currentColor; color: var(--text); }

/* ── Responsibilities ──────────────────────────────────────── */
.resp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resp-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.resp-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}

/* ── System Prompt Preview ─────────────────────────────────── */
.prompt-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Config Row ────────────────────────────────────────────── */
.config-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.config-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 14px;
}

.ci-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 5px; }
.ci-value { font-size: 13px; font-weight: 700; font-family: 'Geist Mono', monospace; }

.api-key-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.api-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.api-input:focus { border-color: var(--s0); }

.api-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  transition: color 0.15s;
}

.api-toggle:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   PIPELINE BOARD VIEW
═══════════════════════════════════════════════════════════ */
.pipeline-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pipeline-stage-bar {
  height: 46px;
  background: var(--surf);
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  overflow-x: auto;
}

.pstage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 100%;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  flex-shrink: 0;
  cursor: default;
}

.pstage-dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pstage-name  { text-transform: uppercase; letter-spacing: 0.8px; }
.pstage-count {
  background: var(--surf3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 1px 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.pstage-sep { color: var(--muted2); padding: 0 4px; font-size: 12px; }

/* ── Board Columns ─────────────────────────────────────────── */
.board {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
}

.column {
  min-width: 300px;
  max-width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  position: relative;
}

/* Stage accent bar */
.column::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.col-0::after { background: var(--s0); }
.col-1::after { background: var(--s1); }
.col-2::after { background: var(--s2); }
.col-3::after { background: var(--s3); }
.col-4::after { background: var(--s4); }
.col-5::after { background: var(--s5); }

.col-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.col-name { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; flex: 1; }

.col-agent-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 4px;
  border-radius: 12px;
  background: var(--surf2);
  border: 1px solid var(--border2);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.col-agent-pill:hover { border-color: var(--s0); color: var(--text); }

.cap-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
}

.col-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ── Task Cards ────────────────────────────────────────────── */
.card {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 13px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}

/* Priority left stripe */
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 9px 0 0 9px;
}

.card.pri-critical::before { background: #ef4444; }
.card.pri-high::before     { background: #f97316; }
.card.pri-medium::before   { background: #3b82f6; }
.card.pri-low::before      { background: #10b981; }

.card:hover {
  background: var(--surf2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

/* Card states */
.card.is-running {
  border-color: rgba(99,102,241,0.4);
  animation: card-pulse 2s ease-in-out infinite;
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(99,102,241,0.15); }
  50%       { box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
}

.card.needs-approval { border-color: rgba(245,158,11,0.35); }

/* Card internals */
.card-id    { font-family: 'Geist Mono', monospace; font-size: 9px; color: var(--muted2); margin-bottom: 5px; letter-spacing: 0.5px; }
.card-title { font-size: 13px; font-weight: 700; line-height: 1.4; margin-bottom: 6px; }
.card-desc  {
  font-size: 11px; color: var(--muted); line-height: 1.5; margin-bottom: 9px;
  font-family: 'Geist Mono', monospace;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 9px; }

/* Chip variants */
.chip                { padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }
.chip-pri-critical   { background: rgba(239,68,68,0.12); color: #f87171; }
.chip-pri-high       { background: rgba(249,115,22,0.12); color: #fb923c; }
.chip-pri-medium     { background: rgba(59,130,246,0.12); color: #60a5fa; }
.chip-pri-low        { background: rgba(16,185,129,0.12); color: #34d399; }
.chip-label          { background: var(--surf2); color: var(--muted); border: 1px solid var(--border2); }
.chip-src            { background: rgba(6,182,212,0.1); color: #22d3ee; border: 1px solid rgba(6,182,212,0.15); }

/* Agent row inside card */
.card-agent-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  background: var(--bg2);
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 7px;
}

.car-avatar { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }
.car-name   { font-size: 11px; font-weight: 700; flex: 1; }
.car-model  { font-size: 9px; color: var(--muted); font-family: 'Geist Mono', monospace; }

/* Status dot */
.card-status { display: flex; align-items: center; gap: 5px; }

.csd           { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.csd.idle      { background: var(--muted2); }
.csd.running   { background: var(--s0); box-shadow: 0 0 5px var(--s0); animation: blink 1.2s ease-in-out infinite; }
.csd.awaiting  { background: var(--s4); animation: blink 1.2s ease-in-out infinite; }
.csd.done      { background: var(--s3); }
.csd.failed    { background: var(--qa); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Live log strip */
.card-live-strip {
  background: #040508;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 7px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 7px;
  max-height: 44px;
  overflow: hidden;
  display: none;
}

.card.is-running .card-live-strip,
.card.done-run   .card-live-strip { display: block; }

/* Scan progress bar */
.scan-bar  { height: 2px; background: var(--border); border-radius: 1px; overflow: hidden; display: none; margin-bottom: 7px; }
.card.is-running .scan-bar { display: block; }
.scan-fill {
  height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--s0), var(--s2));
  border-radius: 1px;
  animation: scan 1.8s ease-in-out infinite;
}

@keyframes scan {
  0%   { transform: translateX(-100%); width: 30%; }
  50%  { width: 60%; }
  100% { transform: translateX(300%); width: 30%; }
}

/* Approval zone */
.approval-zone {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 7px 8px;
  background: rgba(245,158,11,0.05);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 6px;
  margin-top: 4px;
}

.card.needs-approval .approval-zone { display: flex; }

.appr-msg  { font-size: 10px; font-weight: 700; color: #fbbf24; font-family: 'Geist Mono', monospace; }
.appr-btns { display: flex; gap: 5px; }
.appr-btn  {
  flex: 1;
  padding: 5px;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.appr-btn.yes              { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.appr-btn.yes:hover        { background: #10b981; color: #fff; }
.appr-btn.no               { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.appr-btn.no:hover         { background: #ef4444; color: #fff; }

/* Add card button */
.col-add {
  width: 100%;
  padding: 7px;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 6px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.col-add:hover { border-color: var(--s0); color: var(--s0); background: rgba(99,102,241,0.04); }

/* ═══════════════════════════════════════════════════════════
   DETAIL DRAWER
═══════════════════════════════════════════════════════════ */
.drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 500px;
  background: var(--surf);
  border-left: 1px solid var(--border2);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -16px 0 50px rgba(0,0,0,0.5);
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-id {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  background: var(--surf2);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 4px;
  display: inline-block;
}

.drawer-title {
  font-size: 15px;
  font-weight: 700;
  outline: none;
  flex: 1;
  line-height: 1.35;
}

.drawer-close {
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surf2);
  border: 1px solid var(--border2);
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.drawer-close:hover { color: var(--text); }

/* Drawer tabs */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}

.dtab {
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  transition: all 0.15s;
}

.dtab:hover      { color: var(--text); }
.dtab.active     { color: var(--s0); border-bottom-color: var(--s0); }

.drawer-body      { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-body.hide { display: none; }

/* ── Form Fields ────────────────────────────────────────────── */
.field       { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }

.field-input,
.field-select,
.field-textarea {
  background: var(--surf2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus  { border-color: var(--s0); }

.field-textarea        { resize: vertical; min-height: 70px; font-family: 'Geist Mono', monospace; font-size: 11px; }
.field-select option   { background: var(--surf2); }
.field-row             { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Terminal ───────────────────────────────────────────────── */
.terminal { background: #020408; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

.term-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  background: var(--surf2);
  border-bottom: 1px solid var(--border);
}

.tdot                    { width: 8px; height: 8px; border-radius: 50%; }
.tdot:nth-child(1)       { background: #ff5f57; }
.tdot:nth-child(2)       { background: #febc2e; }
.tdot:nth-child(3)       { background: #28c840; }

.term-label {
  margin-left: 6px;
  font-size: 10px;
  font-family: 'Geist Mono', monospace;
  color: var(--muted);
  flex: 1;
}

.run-btn {
  padding: 3px 10px;
  background: var(--s0);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.run-btn:hover    { background: #4f52d8; }
.run-btn:disabled { background: var(--muted2); cursor: not-allowed; }

.term-body {
  padding: 10px;
  min-height: 130px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
}

.tl         { display: flex; gap: 7px; line-height: 1.65; }
.tl-t       { color: #1a2040; flex-shrink: 0; width: 56px; }
.tl-p       { color: var(--s0); flex-shrink: 0; }
.tl-text    { color: #4a5580; }
.tl-success { color: #34d399; }
.tl-warn    { color: #fbbf24; }
.tl-err     { color: #f87171; }
.tl-info    { color: #60a5fa; }

/* ── Comments ───────────────────────────────────────────────── */
.comment    { display: flex; gap: 9px; }
.cmt-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surf3);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border2);
}

.cmt-wrap  { flex: 1; }
.cmt-meta  { font-size: 10px; font-family: 'Geist Mono', monospace; color: var(--muted); margin-bottom: 3px; }
.cmt-text  {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  background: var(--surf2);
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
}

.cmt-text.agent-cmt { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04); }

.cmt-input-row { display: flex; gap: 7px; margin-top: 4px; }
.cmt-input {
  flex: 1;
  background: var(--surf2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.cmt-input:focus { border-color: var(--s0); }

/* Drawer action bar */
.drawer-actions {
  padding: 12px 18px;
  border-top: 1px solid var(--border2);
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.dact         { padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all 0.18s; }
.dact-run     { background: var(--s0); color: #fff; }
.dact-run:hover    { background: #4f52d8; }
.dact-run:disabled { background: var(--muted2); cursor: not-allowed; }
.dact-advance     { background: #10b981; color: #fff; }
.dact-advance:hover { background: #059669; }
.dact-sec         { background: var(--surf2); border: 1px solid var(--border2); color: var(--muted); }
.dact-sec:hover   { color: var(--text); }
.dact-del         { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); margin-left: auto; }
.dact-del:hover   { background: #ef4444; color: #fff; }

/* ═══════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════ */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,11,18,0.85);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.backdrop.open { display: flex; }

.modal {
  background: var(--surf);
  border: 1px solid var(--border2);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  animation: modal-in 0.22s cubic-bezier(0.34,1.4,0.64,1);
  overflow: hidden;
}

@keyframes modal-in {
  from { transform: scale(0.93) translateY(10px); opacity: 0; }
}

.modal-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon  { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: linear-gradient(135deg, var(--s0), var(--s2)); }
.modal-title { font-size: 16px; font-weight: 800; flex: 1; }
.modal-close { color: var(--muted); cursor: pointer; font-size: 17px; padding: 4px; background: none; border: none; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 65vh;
  overflow-y: auto;
}

.modal-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border2);
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.mact         { padding: 8px 18px; border-radius: 7px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all 0.18s; }
.mact-primary { background: var(--s0); color: #fff; }
.mact-primary:hover { background: #4f52d8; }
.mact-cancel  { background: var(--surf2); border: 1px solid var(--border2); color: var(--muted); }
.mact-cancel:hover  { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════ */
.notif {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--surf2);
  border: 1px solid var(--border2);
  border-radius: 9px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.notif.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ═══ Editable Agent Fields ═══ */
.agent-hero-name[contenteditable="true"],
.agent-hero-title[contenteditable="true"] {
  cursor: text;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background 0.15s, box-shadow 0.15s;
  outline: none;
}
.agent-hero-name[contenteditable="true"]:hover,
.agent-hero-title[contenteditable="true"]:hover {
  background: var(--surf2);
}
.agent-hero-name[contenteditable="true"]:focus,
.agent-hero-title[contenteditable="true"]:focus {
  background: var(--bg2);
  box-shadow: 0 0 0 2px var(--s3);
}

/* ═══ Add Agent Button ═══ */
.add-agent-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surf2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.add-agent-btn:hover {
  background: var(--s3);
  color: #fff;
  border-color: var(--s3);
}

/* ═══ Danger Button ═══ */
.tbtn-danger {
  color: #ef4444 !important;
  border-color: rgba(239,68,68,0.2) !important;
}
.tbtn-danger:hover {
  background: rgba(239,68,68,0.1) !important;
  border-color: #ef4444 !important;
}

/* ═══ Settings View ═══ */
.settings-layout {
  height: calc(100vh - 50px);
  overflow-y: auto;
}
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ═══ Model Select ═══ */
.model-select {
  font-size: 12px !important;
  padding: 6px 8px !important;
}
.provider-badge {
  font-size: 12px;
  font-weight: 700;
}

/* ═══ AlertManager ═══ */
.alert-empty {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  padding: 12px;
  text-align: center;
  background: var(--surf2);
  border-radius: 6px;
}
.alert-row {
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid #6b7280;
  border-radius: 6px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.alert-row:hover {
  border-color: var(--s3);
}
.alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.alert-sev {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.alert-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.alert-ns {
  font-size: 10px;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  background: var(--surf2);
  padding: 1px 6px;
  border-radius: 4px;
}
.alert-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.alert-time {
  font-size: 10px;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  margin-top: 6px;
}

/* ═══ Report Preview ═══ */
.report-preview {
  margin-top: 10px;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.5;
}
