/* ==========================================================================
   RG-Agent-01 AI 전담 메신저 웹 포털 디자인 시스템 (4종 텔레그램 스킨 완벽 구현)
   Surface: Operate + Command/Inspect (고밀도 멀티룸 관제 · 제로 마케팅 장식)
   ========================================================================== */

:root,
html[data-skin="TELEGRAM_CLASSIC_LIGHT"] {
  --topbar-bg: #517da2;
  --topbar-fg: #ffffff;
  --topbar-sub: #d8ecfa;
  --surface-bg: #ffffff;
  --surface-elevated: #f7f9fb;
  --title-fg: #1a2026;
  --sub-fg: #707c87;
  --divider: #e5eaee;
  --wallpaper-bg: #d6e4c7;
  --wallpaper-dot-a: #c4d6b2;
  --wallpaper-dot-b: #bcd0a8;
  --incoming-bg: #ffffff;
  --incoming-fg: #111820;
  --incoming-time: #8e99a4;
  --outgoing-bg: #effdde;
  --outgoing-fg: #111820;
  --outgoing-time: #5ea353;
  --outgoing-check: #47a041;
  --composer-bg: #ffffff;
  --composer-fg: #111820;
  --composer-hint: #939ea9;
  --composer-icon: #77838f;
  --accent: #3390ec;
  --primary-btn: #517da2;
  --code-fg: #1b5e9e;
  --code-bg: rgba(27, 94, 158, 0.08);
  --pre-bg: #161f29;
  --pre-fg: #e8eef5;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.22);
}

html[data-skin="TELEGRAM_DAY_SKY"] {
  --topbar-bg: #ffffff;
  --topbar-fg: #1a222b;
  --topbar-sub: #2a82da;
  --surface-bg: #ffffff;
  --surface-elevated: #f5f9fd;
  --title-fg: #182028;
  --sub-fg: #6e7b88;
  --divider: #e6ecf2;
  --wallpaper-bg: #dce9f7;
  --wallpaper-dot-a: #cadcef;
  --wallpaper-dot-b: #c1d5ec;
  --incoming-bg: #ffffff;
  --incoming-fg: #111820;
  --incoming-time: #8c97a3;
  --outgoing-bg: #e3f2fd;
  --outgoing-fg: #111820;
  --outgoing-time: #4f87c0;
  --outgoing-check: #2a82da;
  --composer-bg: #ffffff;
  --composer-fg: #111820;
  --composer-hint: #939ea9;
  --composer-icon: #73808d;
  --accent: #2a82da;
  --primary-btn: #2a82da;
  --code-fg: #155799;
  --code-bg: rgba(21, 87, 153, 0.09);
}

html[data-skin="SOFT_CREAM_LIGHT"] {
  --topbar-bg: #f6f2ea;
  --topbar-fg: #25221d;
  --topbar-sub: #3a7b65;
  --surface-bg: #fcf9f4;
  --surface-elevated: #f4efe6;
  --title-fg: #221f1a;
  --sub-fg: #757067;
  --divider: #e8e2d8;
  --wallpaper-bg: #e5eee8;
  --wallpaper-dot-a: #d3e1d8;
  --wallpaper-dot-b: #cadad0;
  --incoming-bg: #fffffc;
  --incoming-fg: #1f1d19;
  --incoming-time: #8f897e;
  --outgoing-bg: #e2f3e7;
  --outgoing-fg: #1a211c;
  --outgoing-time: #4f8d69;
  --outgoing-check: #398258;
  --composer-bg: #fcf9f4;
  --composer-fg: #1f1d19;
  --composer-hint: #948e83;
  --composer-icon: #787268;
  --accent: #2e7d6b;
  --primary-btn: #3b7d6a;
  --code-fg: #205e4e;
  --code-bg: rgba(32, 94, 78, 0.09);
}

html[data-skin="TELEGRAM_NIGHT_DARK"] {
  --topbar-bg: #17212b;
  --topbar-fg: #ffffff;
  --topbar-sub: #64b5f6;
  --surface-bg: #17212b;
  --surface-elevated: #1f2c3a;
  --title-fg: #f3f6f9;
  --sub-fg: #7f91a4;
  --divider: #0b1118;
  --wallpaper-bg: #0e1621;
  --wallpaper-dot-a: #152232;
  --wallpaper-dot-b: #131e2d;
  --incoming-bg: #182533;
  --incoming-fg: #f5f5f5;
  --incoming-time: #6d7f8f;
  --outgoing-bg: #2b5278;
  --outgoing-fg: #f5f5f5;
  --outgoing-time: #7da8d3;
  --outgoing-check: #6ab3f3;
  --composer-bg: #17212b;
  --composer-fg: #ffffff;
  --composer-hint: #6c7883;
  --composer-icon: #7d8b99;
  --accent: #64b5f6;
  --primary-btn: #5288c1;
  --code-fg: #8cc4ff;
  --code-bg: rgba(140, 196, 255, 0.14);
  --pre-bg: #0b121b;
  --pre-fg: #e2ecf7;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.48;
  color: var(--title-fg);
  background: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
}

code,
pre,
.mono {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.hidden {
  display: none !important;
}

button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ==========================================================================
   1. Entra 무서버 Device Code 로그인 오버레이
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: radial-gradient(circle at 20% 20%, var(--wallpaper-dot-a), var(--wallpaper-bg));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: min(540px, 100%);
  background: var(--surface-bg);
  color: var(--title-fg);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.auth-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.auth-brand-row h1 {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 800;
}

.auth-lead {
  margin: 0 0 20px;
  color: var(--sub-fg);
  font-size: 13.5px;
  line-height: 1.6;
}

.auth-stage-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 18px;
}

.auth-hero-btn {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: var(--primary-btn);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.auth-hero-btn:hover:not(:disabled) {
  filter: brightness(1.07);
}

.auth-hero-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.device-code-label {
  text-align: center;
  font-size: 12.5px;
  color: var(--sub-fg);
}

.device-code-value {
  text-align: center;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--surface-bg);
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  padding: 12px;
  user-select: all;
}

.auth-poll-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--sub-fg);
}

.auth-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-meta-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  color: var(--sub-fg);
}

.auth-error-banner {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: var(--danger);
  font-size: 13px;
}

/* ==========================================================================
   2. 상단 글로벌 관제 바
   ========================================================================== */
.portal-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.top-command-bar {
  height: 52px;
  min-height: 52px;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  z-index: 20;
}

.top-left-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.fleet-summary-badge {
  font-size: 11.5px;
  color: var(--topbar-sub);
  font-variant-numeric: tabular-nums;
}

.grid-layout-switcher {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.14);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

html[data-skin="TELEGRAM_DAY_SKY"] .grid-layout-switcher,
html[data-skin="SOFT_CREAM_LIGHT"] .grid-layout-switcher {
  background: rgba(15, 23, 42, 0.07);
}

.layout-btn {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.78;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  white-space: nowrap;
  transition: background 0.14s ease, opacity 0.14s ease;
}

.layout-btn.active {
  background: var(--surface-bg);
  color: var(--accent);
  opacity: 1;
  box-shadow: var(--shadow-sm);
}

.top-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.top-pill-btn,
.top-icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

html[data-skin="TELEGRAM_DAY_SKY"] .top-pill-btn,
html[data-skin="TELEGRAM_DAY_SKY"] .top-icon-btn,
html[data-skin="SOFT_CREAM_LIGHT"] .top-pill-btn,
html[data-skin="SOFT_CREAM_LIGHT"] .top-icon-btn {
  border-color: var(--divider);
  background: var(--surface-elevated);
}

.top-pill-btn.highlight {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 12px;
}

html[data-skin="TELEGRAM_DAY_SKY"] .user-chip,
html[data-skin="SOFT_CREAM_LIGHT"] .user-chip {
  background: var(--surface-elevated);
}

.user-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.user-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-logout-btn {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.75;
  font-size: 11px;
  text-decoration: underline;
  padding: 0 2px;
}

/* ==========================================================================
   3. 메인 3열 레이아웃 (좌측 방 목록 · 중앙 멀티 스플릿 그리드 · 우측 스튜디오)
   ========================================================================== */
.workspace-columns {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width, 300px) 6px minmax(260px, 1fr) 6px var(--studio-width, 410px);
}

body.sidebar-closed .workspace-columns {
  grid-template-columns: 0px 0px minmax(260px, 1fr) 6px var(--studio-width, 410px);
}

body.studio-closed .workspace-columns {
  grid-template-columns: var(--sidebar-width, 300px) 6px minmax(260px, 1fr) 0px 0px;
}

body.sidebar-closed.studio-closed .workspace-columns {
  grid-template-columns: 0px 0px minmax(260px, 1fr) 0px 0px;
}

.fleet-sidebar {
  background: var(--surface-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body.sidebar-closed .fleet-sidebar,
body.sidebar-closed #leftFrameSplitter {
  display: none;
}

body.studio-closed #rightFrameSplitter {
  display: none;
}

.sidebar-controls {
  padding: 10px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-search-row,
.sidebar-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
  font-size: 12.5px;
}

.room-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.room-group-divider {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sub-fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin-bottom: 3px;
  transition: background 0.12s ease;
}

.room-item:hover {
  background: var(--surface-elevated);
}

.room-item.active-pane {
  background: rgba(51, 144, 236, 0.12);
  border-color: rgba(51, 144, 236, 0.35);
}

.room-item.focused-pane {
  background: rgba(51, 144, 236, 0.18);
  border-color: var(--accent);
}

.project-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.project-avatar.sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 12px;
}

.status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-bg);
  background: #94a3b8;
}

.status-dot.running {
  background: #22c55e;
}

.status-dot.streaming {
  background: var(--accent);
}

.room-item-body {
  flex: 1;
  min-width: 0;
}

.room-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.room-std-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--title-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-slot-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
}

.room-item-preview {
  font-size: 12px;
  color: var(--sub-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.room-item-preview.live-status {
  color: var(--accent);
  font-weight: 600;
}

.room-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--sub-fg);
}

.model-mini-pill {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-weight: 600;
}

/* ==========================================================================
   4. 멀티 에이전트 스플릿 그리드 (1창 / 2분할 / 4분할)
   ========================================================================== */
.split-chat-grid {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  background: var(--divider);
  gap: 1px;
}

.split-chat-grid.grid-mode-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.split-chat-grid.grid-mode-2 {
  grid-template-columns: minmax(180px, var(--center-split-pct, 50%)) minmax(180px, 1fr);
  grid-template-rows: 1fr;
}

.split-chat-grid.grid-mode-4 {
  grid-template-columns: minmax(180px, var(--center-split-pct, 50%)) minmax(180px, 1fr);
  grid-template-rows: 1fr 1fr;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--wallpaper-bg);
  position: relative;
}

.split-chat-grid:not(.grid-mode-1) .chat-pane.is-focused {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.pane-topbar {
  background: var(--surface-bg);
  border-bottom: 1px solid var(--divider);
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 4;
}

.pane-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.pane-title-stack {
  min-width: 0;
  flex: 1;
}

.pane-room-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pane-header-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--title-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-room-switcher {
  max-width: 195px;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
}

.pane-hud-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11px;
  color: var(--sub-fg);
  margin-top: 2px;
}

.ctx-gauge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.ctx-gauge-bar {
  width: 48px;
  height: 5px;
  border-radius: 99px;
  background: var(--divider);
  overflow: hidden;
}

.ctx-gauge-fill {
  height: 100%;
  background: var(--accent);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.power-toggle-btn {
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-elevated);
}

.power-toggle-btn.on {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(22, 163, 74, 0.4);
  color: var(--success);
}

.power-toggle-btn.off {
  color: var(--sub-fg);
}

/* 텔레그램 도트 패턴 월페이퍼 */
.pane-messages-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 18px;
  background-color: var(--wallpaper-bg);
  background-image: radial-gradient(var(--wallpaper-dot-a) 1.25px, transparent 1.25px),
    radial-gradient(var(--wallpaper-dot-b) 1.25px, var(--wallpaper-bg) 1.25px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: min(86%, 780px);
  position: relative;
}

.split-chat-grid.grid-mode-4 .msg-row {
  max-width: 94%;
}

.msg-row.outgoing {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.incoming {
  align-self: flex-start;
  align-items: flex-start;
}

/* 핵심 차별화 #3: 추론 과정 & 도구 실행 타임라인 X-Ray 아코디언 칩 */
.xray-container {
  margin-bottom: 5px;
  max-width: 100%;
}

.xray-chip {
  border: 1px solid rgba(51, 144, 236, 0.34);
  background: var(--surface-bg);
  color: var(--title-fg);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

.xray-chip.is-live {
  border-color: var(--accent);
  background: var(--surface-bg);
}

.xray-chip-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xray-timeline-drawer {
  margin-top: 5px;
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 11px;
  padding: 8px 11px;
  font-size: 11.5px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xray-step-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--sub-fg);
}

.xray-step-row strong {
  color: var(--title-fg);
  font-weight: 600;
}

/* 텔레그램 3점 물결 인디케이터 */
.tg-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tg-wave i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: tgWaveBounce 1.15s infinite ease-in-out;
}

.tg-wave i:nth-child(2) {
  animation-delay: 0.16s;
}

.tg-wave i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes tgWaveBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.msg-bubble {
  border-radius: 15px;
  padding: 9px 13px;
  box-shadow: var(--shadow-sm);
  position: relative;
  word-break: break-word;
  min-width: 90px;
}

.msg-row.incoming .msg-bubble {
  background: var(--incoming-bg);
  color: var(--incoming-fg);
  border-top-left-radius: 4px;
}

.msg-row.outgoing .msg-bubble {
  background: var(--outgoing-bg);
  color: var(--outgoing-fg);
  border-top-right-radius: 4px;
}

.msg-sender-hdr {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}

.msg-meta-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 10.5px;
  margin-top: 4px;
}

.msg-row.incoming .msg-meta-foot {
  color: var(--incoming-time);
}

.msg-row.outgoing .msg-meta-foot {
  color: var(--outgoing-time);
}

.msg-check {
  color: var(--outgoing-check);
  font-weight: 700;
}

/* 말풍선 호버 액션 바 */
.msg-hover-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.msg-row:hover .msg-hover-bar,
.msg-row:focus-within .msg-hover-bar {
  opacity: 1;
  pointer-events: auto;
}

/* 인라인 FIDES 승인 카드 */
.inline-approval-card {
  margin-top: 8px;
  border: 1.5px solid var(--warn);
  background: rgba(217, 119, 6, 0.08);
  border-radius: 11px;
  padding: 10px;
}

.approval-hdr {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--warn);
  margin-bottom: 4px;
}

.approval-digest {
  font-size: 10.5px;
  color: var(--sub-fg);
  margin-bottom: 6px;
}

.approval-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ==========================================================================
   5. 대화 입력창 · Steer / STOP / 교차검수 / 멘션 / 슬래시 / 음성 바
   ========================================================================== */
.pane-composer-wrap {
  background: var(--composer-bg);
  border-top: 1px solid var(--divider);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.autocomplete-popup {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 30;
}

.ac-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-size: 12.5px;
}

.ac-item:hover,
.ac-item.active {
  background: rgba(51, 144, 236, 0.14);
}

/* PC 마이크 5.0초 무음 유예 음성 바 */
.voice-live-bar {
  background: rgba(51, 144, 236, 0.1);
  border: 1px solid var(--accent);
  border-radius: 11px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voice-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.voice-meter-track {
  width: 72px;
  height: 7px;
  border-radius: 99px;
  background: var(--divider);
  overflow: hidden;
}

.voice-meter-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.08s linear;
}

.voice-silence-track {
  height: 4px;
  border-radius: 99px;
  background: var(--divider);
  overflow: hidden;
}

.voice-silence-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.voice-preview-text {
  font-size: 12.5px;
  color: var(--title-fg);
  min-height: 18px;
}

.ai-action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-action-left,
.ai-action-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.composer-main-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.composer-textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 8px 11px;
  background: var(--surface-elevated);
  color: var(--composer-fg);
  font-size: 13.5px;
  line-height: 1.45;
}

.composer-textarea::placeholder {
  color: var(--composer-hint);
}

.send-btn {
  border: none;
  border-radius: 11px;
  padding: 9px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.steer-btn {
  border: 1px solid var(--warn);
  border-radius: 9px;
  padding: 4px 10px;
  background: rgba(217, 119, 6, 0.14);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 700;
}

.stop-btn {
  border: 1px solid var(--danger);
  border-radius: 9px;
  padding: 4px 10px;
  background: rgba(220, 38, 38, 0.14);
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 700;
}

/* ==========================================================================
   6. 우측 라이브 아티팩트 · Diff · 칸반 · SOUL 스튜디오
   ========================================================================== */
.studio-panel {
  background: var(--surface-bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

body.studio-closed .studio-panel {
  border-left: none;
}

.studio-header {
  padding: 10px 13px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.studio-room-title {
  font-size: 13.5px;
}

.studio-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--divider);
  background: var(--surface-elevated);
}

.studio-tab {
  border: none;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sub-fg);
  white-space: nowrap;
}

.studio-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface-bg);
}

.tab-count {
  display: inline-block;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-size: 10.5px;
}

.studio-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.studio-section-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.studio-empty {
  padding: 28px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.studio-empty-title {
  font-weight: 800;
  font-size: 15px;
}

.studio-empty-desc {
  margin: 0;
  color: var(--sub-fg);
  font-size: 12.5px;
}

.studio-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.studio-artifact-canvas {
  border: 1px solid var(--divider);
  border-radius: 11px;
  overflow: hidden;
  background: var(--surface-elevated);
}

.studio-numbered-code {
  background: var(--pre-bg);
  color: var(--pre-fg);
  padding: 10px 0;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  max-height: 540px;
}

.code-line {
  display: flex;
  align-items: flex-start;
  padding: 1px 12px;
}

.ln-no {
  width: 36px;
  flex-shrink: 0;
  color: #64748b;
  user-select: none;
  text-align: right;
  padding-right: 10px;
}

.ln-code {
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.studio-code-editor {
  width: 100%;
  min-height: 420px;
  border: none;
  padding: 12px;
  background: var(--pre-bg);
  color: var(--pre-fg);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  resize: vertical;
}

.studio-html-sandbox {
  width: 100%;
  height: 440px;
  border: none;
  background: #ffffff;
}

.studio-md-preview {
  padding: 14px;
  background: var(--surface-bg);
}

/* Diff & 교차검수 뷰어 */
.audit-card {
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-sub {
  font-size: 11.5px;
  color: var(--sub-fg);
  margin-top: 2px;
}

.audit-verdict-box {
  border: 1px solid var(--accent);
  background: var(--surface-bg);
  border-radius: 10px;
  padding: 10px;
}

.audit-verdict-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--sub-fg);
  border-bottom: 1px solid var(--divider);
  padding-bottom: 5px;
  margin-bottom: 6px;
}

.studio-diff-table {
  border: 1px solid var(--divider);
  border-radius: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--pre-bg);
  color: var(--pre-fg);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 11.5px;
  max-height: 420px;
}

.diff-row {
  display: flex;
  align-items: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 1px 8px;
}

.diff-row.diff-add {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.diff-row.diff-del {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.diff-no {
  width: 28px;
  color: #64748b;
  text-align: right;
  padding-right: 6px;
  user-select: none;
}

.diff-sign {
  width: 14px;
  font-weight: 700;
}

.studio-diff-pre,
.studio-compiled-pre {
  background: var(--pre-bg);
  color: var(--pre-fg);
  padding: 10px;
  border-radius: 10px;
  font-size: 11.5px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 360px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 칸반 레인 */
.kanban-lane {
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 8px;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-lane-hdr {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
}

.kanban-card {
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 9px;
  padding: 8px 10px;
}

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent);
}

.kanban-card-title {
  font-weight: 700;
  margin-top: 2px;
}

.kanban-card-spec {
  font-size: 11.5px;
  color: var(--sub-fg);
  margin-top: 2px;
}

.kanban-card-actions {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.kanban-empty-row {
  padding: 10px;
  font-size: 12px;
  color: var(--sub-fg);
  text-align: center;
}

/* ==========================================================================
   7. 마크다운 · 코드 하이라이트 · 공통 폼 컴포넌트
   ========================================================================== */
.markdown-body p {
  margin: 0 0 7px;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.md-h1,
.md-h2,
.md-h3,
.md-h4 {
  margin: 10px 0 6px;
  line-height: 1.3;
}

.md-h1 {
  font-size: 17px;
}
.md-h2 {
  font-size: 15.5px;
}
.md-h3 {
  font-size: 14px;
}

.md-inline-code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.92em;
}

.md-code-card {
  margin: 8px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--pre-bg);
  color: var(--pre-fg);
}

.md-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.md-code-actions {
  display: flex;
  gap: 5px;
}

.md-pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}

.md-pre code,
.markdown-body {
  white-space: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tok-kw {
  color: #7dd3fc;
  font-weight: 600;
}
.tok-str {
  color: #bef264;
}
.tok-comment {
  color: #94a3b8;
  font-style: italic;
}
.tok-num {
  color: #f9a8d4;
}
.tok-diff-add {
  color: #86efac;
}
.tok-diff-del {
  color: #fca5a5;
}
.tok-diff-hunk {
  color: #93c5fd;
}
.tok-diff-hdr {
  color: #fde047;
  font-weight: 700;
}

.md-list {
  margin: 4px 0 8px;
  padding-left: 20px;
}

.md-quote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid var(--accent);
  color: var(--sub-fg);
}

.md-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.md-table th,
.md-table td {
  border: 1px solid var(--divider);
  padding: 5px 8px;
  text-align: left;
}

.md-link {
  color: var(--accent);
  text-decoration: underline;
}

/* 공통 버튼 및 드롭다운 */
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sub-fg);
  margin-bottom: 4px;
}

.std-select,
.std-input,
.std-textarea {
  width: 100%;
  border: 1px solid var(--divider);
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--surface-bg);
  color: var(--title-fg);
  font-size: 13px;
}

.std-select.compact {
  padding: 5px 8px;
  font-size: 12px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.primary-btn {
  border: none;
  border-radius: 10px;
  padding: 9px 15px;
  background: var(--primary-btn);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

.secondary-btn {
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 8px 13px;
  background: var(--surface-elevated);
  color: var(--title-fg);
  font-weight: 600;
  font-size: 12.5px;
}

.danger-btn {
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 10px;
  padding: 8px 13px;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  font-weight: 700;
  font-size: 12.5px;
}

.full-width {
  width: 100%;
}

.icon-btn {
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-chip-btn {
  border: 1px solid var(--divider);
  background: var(--surface-bg);
  color: var(--title-fg);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.mini-chip-btn.accent {
  border-color: rgba(51, 144, 236, 0.45);
  color: var(--accent);
}

.mini-chip-btn.danger {
  border-color: rgba(220, 38, 38, 0.4);
  color: var(--danger);
}

.seg-group {
  display: inline-flex;
  background: var(--surface-elevated);
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sub-fg);
}

.seg-btn.active {
  background: var(--accent);
  color: #ffffff;
}

.copilot-token-badge {
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(51, 144, 236, 0.1);
  border: 1px solid rgba(51, 144, 236, 0.32);
  color: var(--accent);
  font-size: 12px;
}

/* ==========================================================================
   8. 풀스크린 모달 (중앙 스킬 · 중앙 MCP · 배포 위저드) & Cmd+K 팔레트
   ========================================================================== */
.modal-root,
.palette-root {
  position: fixed;
  inset: 0;
  z-index: 700;
}

.modal-backdrop {
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.fullscreen-modal {
  width: min(1280px, 96vw);
  height: min(860px, 92vh);
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compact-modal {
  width: min(560px, 95vw);
  max-height: 88vh;
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fs-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fs-modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.fs-modal-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--sub-fg);
}

.fs-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fs-split-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.fs-left-list {
  border-right: 1px solid var(--divider);
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fs-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
}

.fs-list-item.active {
  border-color: var(--accent);
  background: rgba(51, 144, 236, 0.12);
}

.fs-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.fs-item-sub {
  font-size: 11.5px;
  color: var(--sub-fg);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.role-mini-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-bg);
  border: 1px solid var(--divider);
}

.role-mini-badge.accent {
  color: var(--accent);
  border-color: var(--accent);
}

.fs-right-editor {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.editor-preview-split {
  flex: 1;
  min-height: 280px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.editor-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.fill-height {
  flex: 1;
  min-height: 240px;
}

.md-live-preview {
  flex: 1;
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-elevated);
  overflow-y: auto;
}

.checkbox-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--divider);
  border-radius: 99px;
  background: var(--surface-elevated);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.fs-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.mcp-container-strip {
  padding: 8px 18px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.mcp-ca-chip {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.mcp-ca-chip.on {
  color: var(--success);
  background: rgba(22, 163, 74, 0.12);
}

.mcp-ca-chip.off {
  color: var(--sub-fg);
  background: rgba(148, 163, 184, 0.15);
}

/* 배포 위저드 */
.fs-wizard-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.wiz-form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wiz-two-col {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

.wiz-card {
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.wiz-card h3 {
  margin: 0;
  font-size: 14.5px;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.blueprint-card {
  border: 1px solid var(--divider);
  background: var(--surface-bg);
  border-radius: 11px;
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.blueprint-card.active {
  border: 2px solid var(--accent);
  background: rgba(51, 144, 236, 0.1);
}

.bp-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
}

.bp-meta {
  font-size: 11px;
  color: var(--sub-fg);
}

.group-list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-row-card {
  border: 1px solid var(--divider);
  background: var(--surface-bg);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* 스킨 모달 */
.skin-picker-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.skin-option-card {
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.skin-option-card.active {
  border: 2px solid var(--accent);
}

.skin-swatches {
  display: flex;
}

.swatch-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  margin-right: -5px;
}

.skin-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.skin-option-info span {
  font-size: 12px;
  color: var(--sub-fg);
}

.skin-check {
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}

/* Cmd/Ctrl + K 팔레트 */
.palette-backdrop {
  align-items: flex-start;
  padding-top: 10vh;
}

.cmd-palette {
  width: min(640px, 94vw);
  background: var(--surface-bg);
  border: 1px solid var(--divider);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
}

.cmd-search-icon {
  font-weight: 800;
  color: var(--accent);
}

.cmd-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14.5px;
  outline: none;
}

.cmd-esc {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--divider);
  color: var(--sub-fg);
}

.cmd-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-group-hdr {
  padding: 7px 10px 3px;
  font-size: 11px;
  font-weight: 800;
  color: var(--sub-fg);
}

.cmd-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.cmd-item.selected,
.cmd-item:hover {
  background: rgba(51, 144, 236, 0.15);
}

.cmd-item-icon {
  width: 24px;
  text-align: center;
  font-size: 15px;
}

.cmd-item-main {
  display: flex;
  flex-direction: column;
}

.cmd-item-main small {
  color: var(--sub-fg);
  font-size: 11.5px;
}

/* 기타 유틸리티 & 토스트 */
.studio-Accordion summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 0;
}

.mem-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.mem-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--surface-bg);
  font-size: 12px;
}

.mem-add-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr auto;
  gap: 6px;
  margin-top: 8px;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast-item {
  background: var(--surface-bg);
  color: var(--title-fg);
  border: 1px solid var(--divider);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

.toast-item.error {
  border-left-color: var(--danger);
}

.toast-item.success {
  border-left-color: var(--success);
}

@media (max-width: 1180px) {
  .workspace-columns {
    grid-template-columns: 250px minmax(0, 1fr) 340px;
  }
  .blueprint-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .workspace-columns {
    grid-template-columns: 1fr !important;
  }
  .fleet-sidebar {
    position: fixed;
    top: 52px;
    bottom: 0;
    left: 0;
    width: 290px;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-closed .fleet-sidebar {
    display: none;
  }
  .studio-panel {
    position: fixed;
    top: 52px;
    bottom: 0;
    right: 0;
    width: min(420px, 95vw);
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  body.studio-closed .studio-panel {
    display: none;
  }
  .split-chat-grid.grid-mode-2,
  .split-chat-grid.grid-mode-4 {
    grid-template-columns: 1fr;
  }
  .fs-split-layout,
  .wiz-two-col,
  .editor-preview-split {
    grid-template-columns: 1fr;
  }
}

.room-title-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.role-mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(51, 144, 236, 0.12);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.room-top-right-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.room-rename-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.room-item:hover .room-rename-btn,
.room-rename-btn:focus-visible {
  opacity: 1;
  background: rgba(51, 144, 236, 0.12);
}

/* ==========================================================================
   좌우 프레임 & 중앙 2/4분할 드래그 리사이저 스플리터
   ========================================================================== */
.frame-resizer {
  position: relative;
  width: 6px;
  background: var(--divider);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: background 0.14s ease;
}

.frame-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

.frame-resizer:hover,
.frame-resizer.is-dragging {
  background: var(--accent);
}

.resizer-grip {
  width: 2px;
  height: 36px;
  border-radius: 2px;
  background: rgba(120, 135, 155, 0.55);
  pointer-events: none;
  transition: background 0.14s ease, height 0.14s ease;
}

.frame-resizer:hover .resizer-grip,
.frame-resizer.is-dragging .resizer-grip {
  background: #ffffff;
  height: 52px;
}

.center-split-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--center-split-pct, 50%);
  transform: translateX(-50%);
  width: 8px;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background 0.14s ease;
}

.center-split-resizer:hover,
.center-split-resizer.is-dragging {
  background: rgba(51, 144, 236, 0.45);
}

.edge-reopen-tab {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 35;
  width: 18px;
  height: 54px;
  border: 1px solid var(--divider);
  background: var(--surface-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.edge-reopen-tab.left {
  left: 0;
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.edge-reopen-tab.right {
  right: 0;
  border-right: none;
  border-radius: 8px 0 0 8px;
}

body.sidebar-closed .edge-reopen-tab.left {
  display: inline-flex;
}

body.studio-closed .edge-reopen-tab.right {
  display: inline-flex;
}

body.is-resizing-frames,
body.is-resizing-frames * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-resizing-frames iframe {
  pointer-events: none !important;
}

/* ==========================================================================
   클립보드 캡처 썸네일 바 · 말풍선 인라인 이미지 · 확대 라이트박스
   ========================================================================== */
.pending-attachment-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.1);
  border: 1px solid rgba(51, 144, 236, 0.35);
}

.pending-attachment-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pending-attachment-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--divider);
  cursor: zoom-in;
  background: #ffffff;
  flex-shrink: 0;
}

.pending-file-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.pending-attachment-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 12px;
}

.pending-attachment-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-attachment-meta span {
  color: var(--sub-fg);
  font-size: 11px;
}

.chat-bubble-media-wrap {
  margin-bottom: 6px;
}

.chat-inline-image {
  display: block;
  max-width: min(360px, 100%);
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: zoom-in;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.65);
}

.chat-image-loading {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 12px;
  color: var(--sub-fg);
}

.chat-pane.is-drop-target {
  outline: 3px dashed var(--accent);
  outline-offset: -6px;
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 15, 24, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  cursor: zoom-out;
}

.image-lightbox-img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  background: #ffffff;
}

.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 960px) {
  .frame-resizer,
  .center-split-resizer,
  .edge-reopen-tab {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
