/* ══════════════════════════════════════════════════════════════
   Agent Collab Studio — design system
   ══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root {
  --bg: #060910;
  --bg-2: #0a101c;
  --panel: rgba(14, 21, 34, 0.72);
  --panel-solid: #0d1422;
  --raise: rgba(148, 163, 184, 0.06);
  --line: rgba(148, 163, 184, 0.14);
  --line-soft: rgba(148, 163, 184, 0.08);
  --txt: #e8eefb;
  --txt-2: #b9c6da;
  --muted: #8394ac;
  --faint: #64748b;
  --pickle: #5eead4;
  --pickle-deep: #0f766e;
  --gemini: #60a5fa;
  --gemini-2: #818cf8;
  --codex: #c4b5fd;
  --codex-deep: #7c3aed;
  --amber: #fbbf24;
  --rose: #fb7185;
  --emerald: #34d399;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--txt);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38% 32% at 12% 8%, rgba(94, 234, 212, 0.13), transparent 70%),
    radial-gradient(34% 30% at 88% 4%, rgba(129, 140, 248, 0.16), transparent 70%),
    radial-gradient(40% 36% at 70% 92%, rgba(96, 165, 250, 0.10), transparent 72%),
    linear-gradient(180deg, #070c15 0%, #060910 55%, #05070c 100%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  pointer-events: none;
}
button { font: inherit; color: inherit; }
svg.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-fill { fill: currentColor; stroke: none; }
::selection { background: rgba(94, 234, 212, 0.28); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.28) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }

/* ── shell ─────────────────────────────────────────────────── */
.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  flex: none;
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(8, 13, 22, 0.92), rgba(8, 13, 22, 0.55));
  backdrop-filter: blur(14px);
}
.topbar-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: block; flex: none; filter: drop-shadow(0 6px 16px rgba(94, 234, 212, 0.22)); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { min-width: 0; }
.brand-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-line h1 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.brand-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 8px; border-radius: 99px;
  color: #99f6e4; border: 1px solid rgba(94, 234, 212, 0.28); background: rgba(94, 234, 212, 0.1);
}
#missionSub { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.topbar-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.btn, .ctl {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: rgba(148, 163, 184, 0.06);
  color: var(--txt-2); border-radius: 10px; padding: 7px 11px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .12s;
}
.btn:hover, .ctl:hover { background: rgba(148, 163, 184, 0.13); color: #fff; border-color: rgba(148, 163, 184, 0.26); }
.btn:active, .ctl:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0e7490);
  border-color: rgba(94, 234, 212, 0.42); color: #f0fffd;
  box-shadow: 0 8px 22px -12px rgba(45, 212, 191, 0.75);
}
.btn-primary:hover { background: linear-gradient(135deg, #0d9488, #0891b2); color: #fff; }
.btn-primary.is-pause { background: linear-gradient(135deg, #b45309, #a16207); border-color: rgba(251, 191, 36, 0.45); box-shadow: 0 8px 22px -12px rgba(251, 191, 36, 0.6); }
.btn-primary.is-pause:hover { background: linear-gradient(135deg, #d97706, #ca8a04); }
.btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 6px 10px; font-size: 11.5px; }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08); color: var(--txt-2); cursor: pointer;
}
.iconbtn:hover { background: rgba(148, 163, 184, 0.16); color: #fff; }

/* stage bar */
.stagebar { display: flex; align-items: center; gap: 12px; padding: 10px 0 9px; }
.stagebar-track { display: flex; gap: 4px; flex: 1; min-width: 0; }
.stage-seg {
  height: 4px; flex: 1; border-radius: 99px; background: rgba(148, 163, 184, 0.14);
  transition: background .35s, box-shadow .35s; min-width: 4px;
}
.stage-seg.is-done { background: rgba(94, 234, 212, 0.5); }
.stage-seg.is-now { background: linear-gradient(90deg, #5eead4, #60a5fa); box-shadow: 0 0 12px rgba(94, 234, 212, 0.55); }
.stagebar-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; flex: none; }
.stage-name { color: var(--txt-2); font-weight: 600; }
.stage-count { color: var(--faint); font-family: var(--mono); }

/* mobile tabs */
.mtabs { display: none; flex: none; padding: 6px 10px; gap: 6px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 13, 22, 0.8); }
.mtab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.mtab.is-active { color: #ccfbf1; background: rgba(94, 234, 212, 0.12); border-color: rgba(94, 234, 212, 0.28); }
.mtab-dot { font-size: 10px; padding: 0 5px; border-radius: 99px; background: rgba(148, 163, 184, 0.16); color: var(--txt-2); font-family: var(--mono); }

/* workspace */
.workspace {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 352px;
  gap: 0;
}
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.panel-left { border-right: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(11, 17, 28, 0.5), rgba(9, 14, 24, 0.28)); }
.panel-right { border-left: 1px solid var(--line-soft); background: linear-gradient(180deg, rgba(11, 17, 28, 0.5), rgba(9, 14, 24, 0.28)); }
.panel-scroll { overflow-y: auto; overflow-x: hidden; padding: 14px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.panel-hint { font-size: 10.5px; color: var(--faint); }
.eyebrow { font-size: 9.5px; font-weight: 800; letter-spacing: 0.16em; color: var(--faint); font-family: var(--mono); }

/* mission card */
.mission-card {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(94, 234, 212, 0.08), rgba(96, 165, 250, 0.05) 55%, rgba(14, 21, 34, 0.6));
  padding: 13px; position: relative; overflow: hidden;
}
.mission-card::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.18), transparent 68%);
  pointer-events: none;
}
.mission-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mission-state {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  color: #ccfbf1; background: rgba(94, 234, 212, 0.14); border: 1px solid rgba(94, 234, 212, 0.26);
}
.mission-state.is-running { color: #fde68a; background: rgba(251, 191, 36, 0.13); border-color: rgba(251, 191, 36, 0.3); }
.mission-state.is-done { color: #bbf7d0; background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.3); }
.mission-title { margin: 9px 0 0; font-size: 15px; line-height: 1.42; font-weight: 800; letter-spacing: -0.015em; word-break: keep-all; overflow-wrap: break-word; }
.mission-goal { margin: 6px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--txt-2); overflow-wrap: anywhere; }
.tagrow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag {
  font-size: 10.5px; padding: 3px 7px; border-radius: 7px; color: #a5f3fc;
  background: rgba(96, 165, 250, 0.1); border: 1px solid rgba(96, 165, 250, 0.22);
}
.tag.k { color: #bbf7d0; background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.22); }
.metarow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.meta { font-size: 10px; color: var(--muted); padding: 2px 6px; border-radius: 6px; background: rgba(148, 163, 184, 0.07); }
.meta b { color: var(--txt-2); font-weight: 700; }

/* agents */
.agent-list { display: flex; flex-direction: column; gap: 8px; }
.agent {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 11px;
  background: rgba(14, 21, 34, 0.62); position: relative; overflow: hidden;
  transition: border-color .2s, background .2s;
}
.agent.is-active { border-color: rgba(94, 234, 212, 0.3); background: rgba(17, 27, 42, 0.9); }
.agent.is-active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px;
  background: var(--agent-c, var(--pickle)); border-radius: 2px;
}
.agent-top { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #06121a;
  background: var(--agent-bg, linear-gradient(135deg, #5eead4, #2dd4bf));
  box-shadow: 0 6px 16px -10px var(--agent-c, #5eead4);
}
.agent-id { min-width: 0; flex: 1; }
.agent-name { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-pill {
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em; padding: 2px 5px; border-radius: 5px;
  color: var(--agent-c, #5eead4); background: var(--agent-soft, rgba(94, 234, 212, 0.12));
}
.agent-sub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 10px; color: var(--faint); }
.agent-status { display: inline-flex; align-items: center; gap: 5px; color: var(--txt-2); font-weight: 600; }
.dotl { width: 5px; height: 5px; border-radius: 99px; background: var(--faint); }
.dotl.on { background: var(--emerald); box-shadow: 0 0 8px rgba(52, 211, 153, 0.8); }
.dotl.work { background: var(--amber); animation: blink 1.1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.agent-count { font-family: var(--mono); color: var(--faint); }

/* protocol */
.protocol { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.protocol-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.protocol-list li { font-size: 10.5px; color: var(--muted); line-height: 1.5; padding-left: 16px; position: relative; }
.protocol-list { counter-reset: p; }
.protocol-list li { counter-increment: p; }
.protocol-list li::before { content: counter(p, decimal-leading-zero); position: absolute; left: 0; top: 1px; color: var(--faint); font-family: var(--mono); font-size: 9px; }
.protocol-list b { color: var(--txt-2); }

/* ── chat ─────────────────────────────────────────────────── */
.panel-chat { background: rgba(6, 10, 17, 0.42); min-width: 0; }
.chat-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 14, 24, 0.5);
}
.chat-head-left, .chat-head-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-title { font-size: 12px; font-weight: 700; color: var(--txt-2); white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--faint); flex: none; }
.live-dot.on { background: var(--emerald); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14); }
.live-dot.busy { background: var(--amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14); animation: blink 1.2s infinite; }
.msgcount { font-size: 10.5px; color: var(--faint); font-family: var(--mono); white-space: nowrap; }
.mini { border: 1px solid var(--line-soft); background: transparent; color: var(--faint); font-size: 10.5px; padding: 3px 7px; border-radius: 7px; cursor: pointer; }
.mini:hover { color: var(--txt); background: rgba(148, 163, 184, 0.1); }
.mini.is-on { color: #ccfbf1; border-color: rgba(94, 234, 212, 0.35); background: rgba(94, 234, 212, 0.1); }

.feed { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.feed-empty {
  margin: auto; max-width: 460px; text-align: center; padding: 24px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-badge {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.18), rgba(129, 140, 248, 0.18));
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.empty-badge svg { width: 28px; height: 28px; stroke: #ccfbf1; }
.feed-empty h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.feed-empty p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.empty-steps { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 2px; }
.empty-step { font-size: 10.5px; color: var(--txt-2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; background: rgba(148, 163, 184, 0.06); }

.msg { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.msg.is-user { flex-direction: row-reverse; }
.msg .avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 11.5px; margin-top: 2px; }
.msg-body { min-width: 0; max-width: min(86%, 720px); display: flex; flex-direction: column; gap: 5px; }
.msg.is-user .msg-body { align-items: flex-end; }
.msg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg.is-user .msg-meta { flex-direction: row-reverse; }
.msg-name { font-size: 11.5px; font-weight: 800; color: var(--txt); }
.msg-tag { font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; color: var(--agent-c, #5eead4); background: var(--agent-soft, rgba(94, 234, 212, 0.1)); border: 1px solid transparent; }
.msg-time { font-size: 9.5px; color: var(--faint); font-family: var(--mono); }
.msg-stage { font-size: 9px; color: var(--faint); letter-spacing: 0.04em; }
.bubble {
  border: 1px solid var(--line); border-radius: 14px; border-top-left-radius: 5px;
  background: linear-gradient(180deg, rgba(17, 26, 41, 0.95), rgba(12, 19, 31, 0.95));
  padding: 11px 13px; font-size: 12.5px; line-height: 1.72; color: #dbe5f4;
  word-break: keep-all; overflow-wrap: break-word; width: 100%;
}
.msg.is-user .bubble {
  border-top-left-radius: 14px; border-top-right-radius: 5px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.28), rgba(8, 145, 178, 0.2));
  border-color: rgba(94, 234, 212, 0.3); color: #f0fdfa;
}
.msg.is-lead .bubble { border-color: rgba(94, 234, 212, 0.22); }
.bubble p { margin: 0 0 7px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble b, .bubble strong { color: #fff; font-weight: 700; }
.bubble code { font-family: var(--mono); font-size: 11px; background: rgba(148, 163, 184, 0.14); padding: 1px 4px; border-radius: 4px; color: #a5f3fc; }
.mention { color: var(--pickle); font-weight: 700; }
.bullets { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bullets li { position: relative; padding-left: 15px; line-height: 1.66; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 99px; background: var(--agent-c, var(--pickle)); opacity: .8; }
.bullets li b { color: #fff; }
.bubble .num-list { counter-reset: n; }
.bubble .num-list li { counter-increment: n; padding-left: 22px; }
.bubble .num-list li::before {
  content: counter(n); width: 15px; height: 15px; border-radius: 4px; top: 4px; left: 0;
  display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #06121a;
  background: var(--agent-c, var(--pickle)); opacity: 1;
}
.callout {
  margin-top: 9px; border-left: 2px solid var(--agent-c, var(--pickle));
  background: rgba(148, 163, 184, 0.06); border-radius: 0 8px 8px 0;
  padding: 8px 10px; font-size: 11.5px; color: var(--txt-2);
}
.callout b { color: #fff; }
.taskop {
  display: flex; align-items: center; gap: 6px; margin-top: 9px;
  font-size: 10.5px; color: var(--muted); border-top: 1px dashed var(--line);
  padding-top: 8px; flex-wrap: wrap;
}
.taskop .chip-task { font-family: var(--mono); color: var(--txt-2); background: rgba(148, 163, 184, 0.1); padding: 2px 5px; border-radius: 4px; }
.taskop .st { font-weight: 700; }
.st.done { color: var(--emerald); }
.st.now { color: var(--sky, #7dd3fc); }
.st.todo { color: var(--faint); }
.bubble .artifact-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  font-size: 10.5px; color: #bae6fd; border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.1); border-radius: 7px; padding: 4px 8px;
}
.fb-quote {
  border-left: 2px solid rgba(251, 191, 36, 0.6); background: rgba(251, 191, 36, 0.08);
  padding: 7px 10px; border-radius: 0 8px 8px 0; margin: 0 0 8px;
  font-size: 11.5px; color: #fde68a;
}

.typing { flex: none; display: flex; align-items: center; gap: 7px; padding: 6px 18px 2px; font-size: 11px; color: var(--muted); }
.typing[hidden] { display: none; }
.typing-avatar { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #06121a; background: linear-gradient(135deg, #5eead4, #2dd4bf); }
.typing b { color: var(--txt-2); }
.dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.dots i { width: 4px; height: 4px; border-radius: 99px; background: var(--pickle); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }

.composer { flex: none; padding: 8px 12px 12px; border-top: 1px solid var(--line-soft); background: rgba(8, 13, 22, 0.72); }
.chips { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 7px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(148, 163, 184, 0.07); color: var(--txt-2); cursor: pointer;
}
.chip:hover { background: rgba(148, 163, 184, 0.16); color: #fff; }
.chip-pickle { color: #99f6e4; border-color: rgba(94, 234, 212, 0.3); background: rgba(94, 234, 212, 0.09); }
.chip-gemini { color: #bfdbfe; border-color: rgba(96, 165, 250, 0.3); background: rgba(96, 165, 250, 0.09); }
.chip-codex { color: #ddd6fe; border-color: rgba(196, 181, 253, 0.3); background: rgba(196, 181, 253, 0.09); }
.chip-quick { color: var(--muted); border-style: dashed; }
.chip-sep { width: 1px; background: var(--line); flex: none; margin: 2px 3px; }
.composer-row { display: flex; gap: 7px; align-items: center; min-width: 0; }
#composerInput {
  flex: 1; min-width: 0; background: rgba(5, 9, 16, 0.9); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 13px; color: var(--txt); font-size: 12.5px; font-family: inherit;
  outline: none; transition: border-color .16s, box-shadow .16s;
}
#composerInput::placeholder { color: #5b6a80; }
#composerInput:focus { border-color: rgba(94, 234, 212, 0.45); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.09); }
.btn-send { padding: 10px 14px; border-radius: 12px; }

/* ── right panel ──────────────────────────────────────────── */
.rtabs { flex: none; display: flex; gap: 2px; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.rtab {
  flex: 1; border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 700; padding: 6px 4px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap;
}
.rtab:hover { color: var(--txt); }
.rtab.is-active { color: #ccfbf1; background: rgba(94, 234, 212, 0.11); border-color: rgba(94, 234, 212, 0.24); }
.rtab span { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.rpanel { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px; }
.rpanel[hidden] { display: none; }
.report-ready {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid rgba(94, 234, 212, 0.32); border-radius: var(--r-md);
  background: linear-gradient(120deg, rgba(94, 234, 212, 0.15), rgba(96, 165, 250, 0.1));
  padding: 10px 11px; margin-bottom: 11px;
}
.report-ready[hidden] { display: none; }
.report-ready-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.report-ready-txt b { font-size: 11.5px; color: #ccfbf1; }
.report-ready-txt span { font-size: 10px; color: var(--txt-2); line-height: 1.4; }

.task-summary { display: flex; align-items: center; gap: 12px; padding: 3px 2px 11px; }
.task-ring {
  width: 52px; height: 52px; border-radius: 99px; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--pickle) 0deg, rgba(148, 163, 184, 0.16) 0deg);
  position: relative;
}
.task-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 99px; background: #0a111d; }
.task-ring span { position: relative; font-size: 11.5px; font-weight: 800; font-family: var(--mono); color: var(--txt); }
.task-summary-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-summary-text b { font-size: 12.5px; }
.task-summary-text span { font-size: 10px; color: var(--faint); line-height: 1.45; }
.task-bar { height: 4px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; margin: 0 2px 12px; }
.task-bar i { display: block; height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, #5eead4, #60a5fa); transition: width .4s ease; }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px;
  background: rgba(13, 20, 33, 0.66); border-left: 2px solid var(--faint);
  transition: border-color .25s, background .25s, transform .2s;
}
.task[data-status="in_progress"] { border-left-color: #38bdf8; }
.task[data-status="review"] { border-left-color: var(--amber); }
.task[data-status="done"] { border-left-color: var(--emerald); background: rgba(13, 32, 30, 0.5); }
.task.is-fresh { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.98); box-shadow: 0 0 0 0 rgba(94, 234, 212, .35); } 100% { transform: none; box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); } }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.task-id { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.pill { font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 5px; border: 1px solid transparent; white-space: nowrap; }
.pill.todo { color: #94a3b8; background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.18); }
.pill.in_progress { color: #7dd3fc; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.26); }
.pill.review { color: #fcd34d; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.26); }
.pill.done { color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.26); }
.task-title { margin: 6px 0 0; font-size: 11.5px; line-height: 1.55; font-weight: 600; color: var(--txt); word-break: keep-all; overflow-wrap: break-word; }
.task[data-status="done"] .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(52, 211, 153, 0.5); }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; font-size: 9.5px; color: var(--faint); }
.task-owner { display: inline-flex; align-items: center; gap: 4px; color: var(--txt-2); }
.task-owner i { width: 5px; height: 5px; border-radius: 99px; background: var(--agent-c, var(--pickle)); }
.task-meta { font-family: var(--mono); }

.artifact-list { display: flex; flex-direction: column; gap: 9px; }
.artifact { border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(13, 20, 33, 0.72); overflow: hidden; }
.artifact-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.artifact-name { min-width: 0; }
.artifact-name b { display: block; font-size: 11px; font-weight: 700; color: #bae6fd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-name span { font-size: 9.5px; color: var(--faint); }
.artifact pre {
  margin: 0; padding: 9px 10px; max-height: 132px; overflow: auto;
  font-family: var(--mono); font-size: 10px; line-height: 1.6; color: #a9b8cd; white-space: pre-wrap; overflow-wrap: anywhere;
}
.empty-note { font-size: 11px; color: var(--faint); line-height: 1.7; padding: 14px 6px; text-align: center; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; background: rgba(13, 20, 33, 0.66); }
.metric span { display: block; font-size: 10px; color: var(--muted); }
.metric b { display: block; margin-top: 3px; font-size: 18px; font-weight: 800; font-family: var(--mono); letter-spacing: -0.02em; }
.metric-block { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px; background: rgba(13, 20, 33, 0.6); }
.metric-block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 700; color: var(--txt-2); }
.metric-bars { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.mbar-head { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.mbar-head b { color: var(--txt); font-weight: 700; }
.mbar { height: 5px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); margin-top: 4px; overflow: hidden; }
.mbar i { display: block; height: 100%; border-radius: 99px; background: var(--agent-bg); transition: width .5s ease; }
.metric-note { margin: 8px 0 0; font-size: 10.5px; line-height: 1.65; color: var(--faint); }
.feedback-list { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.fb-item { font-size: 10.5px; color: var(--txt-2); border-left: 2px solid rgba(251, 191, 36, 0.55); padding-left: 8px; line-height: 1.55; overflow-wrap: anywhere; }
.fb-item span { display: block; font-size: 9px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }

/* ── overlays / modal / drawers ───────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(3, 6, 12, 0.72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay[hidden] { display: none; }
.overlay-right { justify-content: flex-end; padding: 0; }
.modal {
  width: min(620px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 20px; background: linear-gradient(180deg, #0e1726, #0a1220);
  box-shadow: var(--shadow); overflow: hidden;
}
.modal-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); flex: none; }
.modal-head h2, .drawer-head h2 { margin: 4px 0 0; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { overflow-y: auto; padding: 14px 18px 18px; min-height: 0; }
.preset-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 16px; }
.preset {
  text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px;
  background: rgba(148, 163, 184, 0.05); cursor: pointer; transition: border-color .16s, background .16s;
}
.preset:hover { border-color: rgba(94, 234, 212, 0.4); background: rgba(94, 234, 212, 0.07); }
.preset.is-picked { border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.1); }
.preset b { display: block; font-size: 11.5px; font-weight: 700; line-height: 1.45; color: var(--txt); }
.preset span { display: block; margin-top: 3px; font-size: 10px; color: var(--faint); line-height: 1.5; }
.form { display: flex; flex-direction: column; gap: 11px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; font-weight: 700; color: var(--txt-2); }
.field > span i { font-style: normal; font-weight: 500; color: var(--faint); margin-left: 4px; }
.field input, .field textarea {
  width: 100%; background: rgba(5, 9, 16, 0.85); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font-family: inherit; font-size: 12px; color: var(--txt); outline: none;
  resize: vertical; line-height: 1.6; transition: border-color .16s, box-shadow .16s;
}
.field input:focus, .field textarea:focus { border-color: rgba(94, 234, 212, 0.45); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.08); }
.field input::placeholder, .field textarea::placeholder { color: #566377; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.form-note { margin: 0; font-size: 10px; color: var(--faint); line-height: 1.55; max-width: 320px; }

.drawer {
  width: min(760px, 100%); height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0c1422, #080e18); border-left: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: -30px 0 70px -40px #000; animation: slide .28s ease;
}
.drawer-history { width: min(460px, 100%); }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-tools { flex: none; display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; background: rgba(148, 163, 184, 0.03); }
.drawer-note { margin: 0; padding: 10px 18px 0; font-size: 10.5px; line-height: 1.6; color: var(--faint); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 18px 28px; }

/* report typography */
.report-body h1 { font-size: 20px; line-height: 1.35; margin: 4px 0 6px; letter-spacing: -0.025em; }
.report-body .rsub { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.report-body h2 { font-size: 13px; margin: 22px 0 9px; padding-bottom: 6px; border-bottom: 1px solid var(--line); letter-spacing: -0.01em; display: flex; align-items: center; gap: 7px; }
.report-body h2 .n { font-family: var(--mono); font-size: 10px; color: var(--pickle); border: 1px solid rgba(94, 234, 212, 0.3); border-radius: 5px; padding: 1px 5px; }
.report-body h3 { font-size: 11.5px; margin: 14px 0 5px; color: var(--txt-2); }
.report-body p { margin: 0 0 8px; font-size: 12px; line-height: 1.75; color: var(--txt-2); word-break: keep-all; overflow-wrap: break-word; }
.report-body ul, .report-body ol { margin: 0 0 10px; padding-left: 18px; font-size: 12px; line-height: 1.75; color: var(--txt-2); }
.report-body li { margin-bottom: 4px; word-break: keep-all; overflow-wrap: break-word; }
.report-body b { color: #fff; }
.report-body code { font-family: var(--mono); font-size: 10.5px; background: rgba(148, 163, 184, 0.14); padding: 1px 4px; border-radius: 4px; color: #a5f3fc; }
.table-wrap { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 600px; }
.report-table th:nth-child(3), .report-table td:nth-child(3) { white-space: nowrap; }
.report-table th, .report-table td { padding: 8px 9px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); line-height: 1.6; }
.report-table th { background: rgba(148, 163, 184, 0.07); color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.report-table td { color: var(--txt-2); }
.report-table tr:last-child td { border-bottom: 0; }
.report-table td b { color: var(--txt); }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.62; color: var(--txt-2); }
.checklist li .box { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid rgba(94, 234, 212, 0.45); flex: none; margin-top: 2px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.summary-cell { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: rgba(148, 163, 184, 0.04); }
.summary-cell span { display: block; font-size: 9.5px; letter-spacing: 0.06em; color: var(--faint); font-weight: 700; }
.summary-cell b { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.55; color: var(--txt); font-weight: 600; overflow-wrap: anywhere; }
.report-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* history */
.hist-item { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: rgba(148, 163, 184, 0.04); padding: 11px; margin-bottom: 8px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.hist-item:hover { border-color: rgba(94, 234, 212, 0.35); background: rgba(94, 234, 212, 0.06); }
.hist-main { flex: 1; min-width: 0; }
.hist-main b { display: block; font-size: 12px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.hist-main span { display: block; margin-top: 3px; font-size: 10px; color: var(--faint); }
.hist-badge { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 5px; color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.24); white-space: nowrap; }
.hist-badge.part { color: #fcd34d; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.24); }
.hist-del { border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 3px; border-radius: 5px; }
.hist-del:hover { color: #fda4af; background: rgba(251, 113, 133, 0.12); }

/* toast */
.toast {
  position: fixed; left: 50%; top: 96px; transform: translateX(-50%);
  z-index: 90; padding: 9px 14px; border-radius: 10px; font-size: 11.5px; font-weight: 600;
  color: #f0fdfa; background: rgba(15, 23, 42, 0.96); border: 1px solid rgba(94, 234, 212, 0.35);
  box-shadow: 0 18px 40px -20px #000; max-width: min(92vw, 460px); text-align: center;
}
.toast[hidden] { display: none; }

/* focus mode: hide side panels */
.app.focus-left .panel-left, .app.focus-left .panel-right { display: none; }
.app.focus-left .workspace { grid-template-columns: minmax(0, 1fr); }

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 1240px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr) 314px; }
  #missionSub { max-width: 30vw; }
}
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel-left, .panel-right { display: none; border: 0; }
  .app.show-agents .panel-left { display: flex; }
  .app.show-agents .panel-chat, .app.show-agents .panel-right { display: none; }
  .app.show-workspace .panel-right { display: flex; }
  .app.show-workspace .panel-chat, .app.show-workspace .panel-left { display: none; }
  .mtabs { display: flex; }
}
@media (max-width: 720px) {
  .topbar { padding: 10px 12px 0; }
  .brand-line h1 { font-size: 14px; }
  .brand-badge { display: none; }
  #missionSub { max-width: 46vw; font-size: 10.5px; }
  .brand-mark { width: 32px; height: 32px; }
  .topbar-main { gap: 8px; }
  .topbar-controls { gap: 5px; }
  .ctl, .btn { padding: 6px 8px; font-size: 11px; }
  .ctl-txt { display: none; }
  #btnAuto span { display: inline; }
  #btnNew .ctl-txt, #btnHistory .ctl-txt { display: none; }
  .stagebar { gap: 8px; padding: 8px 0 7px; }
  .stagebar-meta { font-size: 10px; }
  .feed { padding: 14px 10px 6px; gap: 14px; }
  .msg-body { max-width: 90%; }
  .bubble { font-size: 12px; padding: 10px 11px; }
  .chat-head { padding: 9px 12px; }
  .composer { padding: 6px 10px 10px; }
  .modal { border-radius: 16px; }
  .preset-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .report-body h1 { font-size: 17px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92dvh; border-radius: 16px 16px 0 0; }
}
@media (max-width: 720px) {
  .toast { top: 128px; }
}
@media (max-width: 420px) {
  .brand-mark { display: none; }
  .topbar { padding: 9px 10px 0; }
  .panel-scroll { padding: 11px; }
  .rpanel { padding: 10px; }
  .metric-grid { grid-template-columns: 1fr; }
  .msg .avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
  .msg-body { max-width: 88%; }
  .drawer-body { padding: 12px 12px 24px; }
  .drawer-tools { padding: 8px 12px; }
  .drawer-head, .modal-head { padding: 13px 14px 10px; }
  .modal-body { padding: 12px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
