* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #1e1e2e;
  --surface: #181825;
  --overlay: #313244;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --accent: #89b4fa;
  --green: #a6e3a1;
  --red: #f38ba8;
  --titlebar-h: 36px;
  --pane-header-h: 28px;
  --voice-bar-h: 56px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

html {
  position: fixed;
  width: 100%;
}

body {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}

/* ── 타이틀바 ── */
#titlebar {
  height: var(--titlebar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--overlay);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
  /* -webkit-app-region: drag; — 버튼 클릭 차단 방지 */
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 16px;
}

.title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.menu {
  display: flex;
  gap: 2px;
  margin-left: 12px;
}

.menu-item {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.menu-item:hover {
  background: var(--overlay);
  color: var(--text);
}

.menu-item.active {
  background: var(--overlay);
  color: var(--accent);
}

.titlebar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--overlay);
  color: var(--text);
}

/* ── 터미널 컨테이너 ── */
#terminals {
  flex: 1;
  min-height: 0; /* flex 자식이 overflow 되지 않도록 */
  display: flex;
  gap: 1px;
  background: var(--overlay);
}

.terminal-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 200px;
  position: relative;
}

.pane-header {
  height: var(--pane-header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--overlay);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.pane-title {
  font-size: 11px;
  color: var(--subtext);
}

.btn-close {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 12px;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-close:hover {
  background: var(--red);
  color: var(--bg);
}

.btn-restart {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 14px;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-right: 12px;
}

.btn-restart:hover {
  background: var(--blue, #89b4fa);
  color: var(--bg);
}

.btn-restart:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* 1칸 모드: pane-header 숨겨질 때 플로팅 재시작 버튼 */
.btn-restart-float {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--overlay);
  color: var(--subtext);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0;
}

.terminal-pane:hover .btn-restart-float {
  opacity: 1;
}

#terminals.single .btn-restart-float {
  display: flex;
}

.btn-restart-float:hover {
  background: var(--blue, #89b4fa);
  color: var(--bg);
  opacity: 1;
}

.btn-restart-float:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* 터치 기기(아이패드 등): hover 없으므로 항상 표시 */
@media (hover: none) {
  .btn-restart-float {
    opacity: 0.6;
  }
}

.terminal-frame {
  flex: 1;
  border: none;
  width: 100%;
  background: var(--bg);
}

/* 스크롤 프록시 오버레이 (전 플랫폼: wheel + touch) */
.scroll-overlay {
  position: absolute;
  top: var(--pane-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  touch-action: none;
  background: transparent;
}

/* 1개 터미널일 때 pane-header 숨기면 오버레이도 top 조정 */
#terminals.single .scroll-overlay {
  top: 0;
}

/* ── 활성 터미널 표시 ── */
.terminal-pane.active .pane-header {
  border-bottom: 2px solid var(--accent, var(--blue, #89b4fa));
}

.terminal-pane.active .pane-title {
  color: var(--accent, var(--blue, #89b4fa));
}

/* ── 1개 터미널일 때 pane-header 숨김 ── */
#terminals.single .pane-header {
  display: none;
}

/* ── 레이아웃 모드 버튼 그룹 ── */
.layout-group {
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--overlay);
  border-radius: 4px;
  padding: 1px;
}

.btn-layout-mode {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 13px;
  width: 26px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.15s;
}

.btn-layout-mode:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-layout-mode.active {
  background: var(--accent);
  color: var(--bg);
}

/* ── 2칸 모드 (좌우 분할) ── */
#terminals.layout-2 {
  flex-direction: row;
}

#terminals.layout-2 .terminal-pane {
  flex: 1;
}

/* ── 4분면 모드 (2x2 그리드) ── */
#terminals.layout-4 {
  flex-wrap: wrap;
}

#terminals.layout-4 .terminal-pane {
  flex: none;
  width: calc(50% - 1px);
  height: 50%;
}

#terminals.layout-4 .resize-handle {
  display: none;
}

/* ── 세로 분할 (legacy) ── */
#terminals.vertical {
  flex-direction: column;
}

/* ── 리사이즈 핸들 ── */
.resize-handle {
  width: 4px;
  background: var(--overlay);
  cursor: col-resize;
  transition: background 0.15s;
  flex-shrink: 0;
}

.resize-handle:hover,
.resize-handle.active {
  background: var(--accent);
}

#terminals.vertical .resize-handle {
  width: auto;
  height: 4px;
  cursor: row-resize;
}

/* ── 입력 바 ── */
#voice-bar {
  height: var(--voice-bar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  position: relative;
  z-index: 10;
}

.btn-bar-action {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--overlay);
  background: transparent;
  color: var(--subtext);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-bar-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-bar-action:active {
  background: var(--accent);
  color: var(--bg);
}

.btn-bar-action.btn-clear:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-bar-action.btn-clear:active {
  background: var(--red);
  color: var(--bg);
}

.text-input {
  flex: 1;
  max-width: 600px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 0 12px;
  outline: none;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  transition: border-color 0.15s;
}

.text-input:focus {
  border-color: var(--accent);
}

.text-input::placeholder {
  color: var(--subtext);
  opacity: 0.6;
}

.text-input.voice-interim {
  color: var(--subtext);
  font-style: italic;
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--overlay);
  background: var(--bg);
  color: var(--subtext);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-send:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-send:active {
  background: var(--green);
  color: var(--bg);
}

.btn-voice {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--overlay);
  background: var(--bg);
  color: var(--subtext);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-voice:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-voice.listening {
  border-color: var(--red);
  color: var(--red);
  background: rgba(243, 139, 168, 0.1);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 139, 168, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(243, 139, 168, 0); }
}

.voice-status {
  font-size: 11px;
  color: var(--subtext);
  position: absolute;
  left: 16px;
}

.voice-text {
  font-size: 12px;
  color: var(--text);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 복사 모드 ── */
.btn-icon.copy-mode-active {
  background: var(--accent);
  color: var(--bg);
}

.copy-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.copy-overlay-hint {
  background: var(--overlay);
  color: var(--accent);
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.copy-textarea {
  flex: 1;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px;
  border: none;
  outline: none;
  resize: none;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.copy-all-btn {
  padding: 4px 12px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

/* ── 프로젝트 뷰 ── */
#projects-view {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

#project-list {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--overlay);
  overflow-y: auto;
  padding: 8px 0;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s;
  gap: 6px;
}

.project-item:hover {
  background: var(--overlay);
}

.project-item.active {
  background: var(--overlay);
  border-left: 2px solid var(--accent);
}

.project-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-item.active .project-name {
  color: var(--accent);
}

.project-badges {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.badge-arch { background: rgba(137, 180, 250, 0.2); color: var(--accent); }
.badge-know { background: rgba(166, 227, 161, 0.2); color: var(--green); }
.badge-ws { background: rgba(203, 166, 247, 0.2); color: #cba6f7; }

/* GitHub 아이콘 */
.github-icon {
  color: var(--subtext);
  vertical-align: middle;
  flex-shrink: 0;
}

.project-item:hover .github-icon {
  color: var(--text);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.github-link {
  color: var(--subtext);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.github-link:hover {
  color: var(--text);
}

/* ── Git 탭 ── */
.git-status { padding: 4px 0; }
.git-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface); border-radius: 8px; margin-bottom: 12px; }
.git-branch { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.git-branch-icon { font-size: 16px; color: var(--subtext); }
.git-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.git-dirty { background: rgba(243,139,168,0.15); color: var(--red); }
.git-clean { background: rgba(166,227,161,0.15); color: var(--green); }
.git-sync { font-size: 12px; margin-left: 4px; }
.git-changes { font-size: 12px; color: var(--subtext); }
.git-section-title { font-size: 12px; color: var(--subtext); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.git-commits { display: flex; flex-direction: column; gap: 4px; }
.git-commit { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.git-commit:hover { background: var(--surface); }
.git-hash { font-family: monospace; font-size: 12px; color: var(--accent); min-width: 60px; }
.git-msg { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#project-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--subtext);
  font-size: 14px;
}

.loading {
  padding: 20px;
  color: var(--subtext);
  font-size: 13px;
}

/* ── 대시보드 ── */
.dashboard {
  padding: 20px;
  overflow-y: auto;
  height: 100%;
}

.dashboard-item {
  border-bottom: 1px solid var(--overlay);
  margin-bottom: 4px;
  padding-bottom: 10px !important;
}

/* 메트릭 카드 */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.metric-card.metric-active {
  border-color: var(--green);
  background: rgba(166, 227, 161, 0.05);
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-active .metric-value {
  color: var(--green);
}

.metric-label {
  font-size: 11px;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 섹션 */
.dash-section {
  margin-bottom: 20px;
}

.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--overlay);
}

.dash-columns {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.dash-empty {
  color: var(--subtext);
  font-size: 12px;
  padding: 12px;
  text-align: center;
  background: var(--surface);
  border-radius: 6px;
}

/* 에이전트 활동 */
.dash-agents {
  overflow-x: auto;
}

.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.agent-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--overlay);
  color: var(--subtext);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.agent-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--overlay);
}
.agent-row-running td { color: var(--yellow); }
.agent-row-done td { color: var(--green); opacity: 0.7; }
.agent-row-error td { color: var(--red); opacity: 0.7; }
.agent-log-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--subtext);
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
  flex: 1;
}

.agent-role {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 2px;
}

.agent-project {
  font-size: 12px;
  color: var(--accent);
}

.agent-status {
  font-size: 11px;
  color: var(--subtext);
  margin-top: 4px;
}

.agent-log {
  font-size: 10px;
  color: var(--subtext);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* 칸반 바 차트 */
.kanban-bars {
  margin-bottom: 14px;
}

.kanban-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.kanban-bar-label {
  width: 50px;
  font-size: 11px;
  color: var(--subtext);
  text-align: right;
  flex-shrink: 0;
}

.kanban-bar-track {
  flex: 1;
  height: 14px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.kanban-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
  min-width: 2px;
}

.kanban-bar-count {
  width: 24px;
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

/* 칸반 테이블 */
.kanban-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.kanban-table th {
  text-align: center;
  padding: 4px 6px;
  color: var(--subtext);
  font-weight: 600;
  border-bottom: 1px solid var(--overlay);
}

.kanban-table th:first-child {
  text-align: left;
}

.kanban-table td {
  padding: 4px 6px;
  text-align: center;
  color: var(--subtext);
  border-bottom: 1px solid rgba(108,112,134,0.1);
}

.kanban-table td:first-child {
  text-align: left;
}

.kanban-table td.has-cards {
  color: var(--text);
  font-weight: 600;
}

.kanban-project-name {
  color: var(--accent) !important;
  font-weight: 500 !important;
}

.kanban-total {
  font-weight: 700 !important;
  color: var(--text) !important;
}

/* 대시보드 에이전트 실행 버튼 */
.kanban-actions {
  white-space: nowrap;
  display: flex;
  gap: 3px;
  justify-content: center;
}

.dash-agent-btn {
  background: var(--surface);
  border: 1px solid var(--overlay);
  color: var(--subtext);
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.dash-agent-btn:hover {
  background: var(--overlay);
  color: var(--text);
}

.dash-agent-btn.dash-fsd {
  background: rgba(250, 179, 135, 0.15);
  color: #fab387;
  border-color: rgba(250, 179, 135, 0.3);
  font-weight: 600;
}

.dash-agent-btn.dash-fsd:hover {
  background: rgba(250, 179, 135, 0.3);
}

.kanban-eos-cell {
  padding-left: 16px !important;
}
.dash-agent-btn.dash-eos {
  background: rgba(243, 139, 168, 0.08);
  color: #f38ba8;
  border-color: rgba(243, 139, 168, 0.2);
  opacity: 0.5;
  transition: all 0.15s;
}
.dash-agent-btn.dash-eos:hover {
  opacity: 1;
  background: rgba(243, 139, 168, 0.2);
}
.dash-agent-btn.dash-eos-armed {
  opacity: 1;
  background: rgba(243, 139, 168, 0.35);
  border-color: #f38ba8;
  font-weight: 700;
  animation: eos-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes eos-pulse {
  from { box-shadow: 0 0 0 0 rgba(243, 139, 168, 0.3); }
  to { box-shadow: 0 0 6px 2px rgba(243, 139, 168, 0.4); }
}

.dash-agent-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 최근 보고서 */
.dash-recent {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-item {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.recent-item:hover {
  background: var(--surface);
}

.recent-time {
  font-size: 10px;
  color: var(--subtext);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: monospace;
}

.recent-title {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 오늘 완료 메트릭 하이라이트 */
.metric-done .metric-value { color: var(--green); }

/* 일별 완료 차트 (Canvas) */
.daily-done-chart-wrap {
  width: 100%;
  height: 160px;
  background: var(--surface);
  border-radius: 8px;
  padding: 4px;
  box-sizing: border-box;
}
.daily-done-chart-wrap canvas {
  display: block;
}

/* 모바일 대시보드 */
@media (max-width: 768px) {
  .dash-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-columns {
    grid-template-columns: 1fr;
  }
  .daily-done-chart-wrap {
    height: 130px;
  }
}

.detail-header {
  padding: 12px 16px 0;
}

.detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.detail-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--overlay);
}

.detail-tab {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.detail-tab:hover {
  background: var(--overlay);
  color: var(--text);
}

.detail-tab.active {
  background: var(--overlay);
  color: var(--accent);
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* 마크다운 본문 */
.markdown-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}

.markdown-body h1 { font-size: 20px; margin: 16px 0 8px; color: var(--accent); border-bottom: 1px solid var(--overlay); padding-bottom: 4px; }
.markdown-body h2 { font-size: 16px; margin: 14px 0 6px; color: var(--text); }
.markdown-body h3 { font-size: 14px; margin: 12px 0 4px; color: var(--text); }
.markdown-body p { margin: 6px 0; }
.markdown-body code { background: var(--overlay); padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: 'Menlo', monospace; }
.markdown-body pre { background: var(--surface); padding: 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; margin: 6px 0; }
.markdown-body li { margin: 2px 0; }
.markdown-body table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--overlay); padding: 6px 10px; font-size: 12px; text-align: left; }
.markdown-body th { background: var(--surface); color: var(--accent); }
.markdown-body blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0; color: var(--subtext); }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body hr { border: none; border-top: 1px solid var(--overlay); margin: 12px 0; }

/* 파일/보고서 리스트 */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item, .report-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.file-item:hover, .report-item:hover {
  background: var(--overlay);
}

.file-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.file-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 11px;
  color: var(--subtext);
  flex-shrink: 0;
}

.file-viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--subtext);
}

.btn-back {
  background: none;
  border: 1px solid var(--overlay);
  color: var(--subtext);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.btn-back:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Anima 뷰 ── */
#anima-view {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

#anima-list {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--overlay);
  overflow-y: auto;
  padding: 0;
}

.anima-list-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 8px;
}

.anima-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.anima-menu-item:hover {
  background: var(--overlay);
}

.anima-menu-item.active {
  background: var(--overlay);
  border-left: 2px solid var(--accent);
}

.anima-menu-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.anima-menu-label {
  font-size: 12px;
  color: var(--text);
}

.anima-menu-item.active .anima-menu-label {
  color: var(--accent);
}

#anima-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.anima-skill-item, .anima-vessel-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.anima-skill-item:hover, .anima-vessel-card:hover {
  background: var(--overlay);
}

.anima-skill-info, .anima-vessel-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.anima-skill-desc {
  font-size: 11px;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.vessel-section-title {
  font-size: 13px;
  color: var(--subtext);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--overlay);
}

/* ── Papyrus 공통 뷰 (Records, Reports, Resources) ── */
.papyrus-view {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

.papyrus-list {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--overlay);
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.papyrus-search {
  padding: 8px;
  border-bottom: 1px solid var(--overlay);
  flex-shrink: 0;
}

.papyrus-search-input {
  width: 100%;
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--overlay);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  padding: 0 8px;
  outline: none;
}

.papyrus-search-input:focus {
  border-color: var(--accent);
}

.papyrus-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s;
  gap: 8px;
  border-bottom: 1px solid rgba(49, 50, 68, 0.3);
}

.papyrus-item:hover {
  background: var(--overlay);
}

.papyrus-item.active {
  background: var(--overlay);
  border-left: 2px solid var(--accent);
}

.papyrus-item-name {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.papyrus-item.active .papyrus-item-name {
  color: var(--accent);
}

.papyrus-item-date {
  font-size: 10px;
  color: var(--subtext);
  flex-shrink: 0;
}

.papyrus-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
}

.wikilink:hover {
  color: var(--green);
  border-color: var(--green);
}

/* ── 칸반 보드 ── */
.kanban-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.kanban-label {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  color: #fff;
}

.btn-add-card {
  background: none;
  border: 1px solid var(--overlay);
  color: var(--subtext);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.kanban-trello-link {
  font-size: 11px;
  color: var(--subtext);
  text-decoration: none;
  margin-left: auto;
}

.kanban-trello-link:hover {
  color: var(--accent);
}

.kanban-board {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: 8px;
}

.kanban-column {
  min-width: 180px;
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.kanban-column-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext);
  padding: 8px 10px;
  border-bottom: 1px solid var(--overlay);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-count {
  font-size: 10px;
  background: var(--overlay);
  padding: 1px 5px;
  border-radius: 8px;
  color: var(--subtext);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
}

.kanban-cards.drag-over {
  background: rgba(137, 180, 250, 0.08);
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--overlay);
  border-radius: 4px;
  padding: 8px;
  cursor: grab;
  transition: all 0.15s;
}

.kanban-card:hover {
  border-color: var(--accent);
}

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-card-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
}

.kanban-card-preview {
  font-size: 10px;
  color: var(--subtext);
  margin-top: 4px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.kanban-card-due {
  font-size: 10px;
  color: var(--subtext);
  margin-top: 4px;
}

.kanban-card-due.done {
  color: var(--green);
}

/* 휴지통 컬럼 */
.kanban-column-trash {
  opacity: 0.7;
}
.kanban-column-trash .kanban-column-header {
  color: var(--red);
}
.kanban-card.card-trashed {
  opacity: 0.6;
  border-left: 2px solid var(--red);
}
.kanban-card-trash-info {
  font-size: 10px;
  color: var(--red);
  margin-top: 4px;
}

/* 진행 중 카드 (개발/리뷰 컬럼) */
.kanban-card.card-active {
  border-left: 2px solid var(--green);
  position: relative;
}

.card-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  position: absolute;
  top: 8px;
  right: 8px;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(166, 227, 161, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(166, 227, 161, 0); }
}

/* 카드 상세 모달 */
/* ── 카드 상세 모달 ── */
.card-detail-modal {
  width: min(2520px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 320px;
  min-height: 300px;
  position: relative;
}

.cd-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtext);
  font-size: 10px;
  opacity: 0.5;
  z-index: 10;
  user-select: none;
}
.cd-resize-handle:hover { opacity: 1; }

.card-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.card-detail-header h3 {
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  margin: 0;
}

.card-detail-header .btn-close {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}

.card-detail-header .btn-close:hover {
  background: var(--overlay);
  color: var(--text);
}

.card-detail-scroll {
  overflow-y: auto;
  flex: 1;
  padding-top: 8px;
}

.cd-trace-id {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(137, 180, 250, 0.15);
  padding: 2px 8px;
  border-radius: 3px;
  margin-top: 4px;
  margin-right: 4px;
  font-family: monospace;
}

.cd-list-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--subtext);
  background: var(--overlay);
  padding: 2px 8px;
  border-radius: 3px;
  margin-top: 4px;
}

/* 라벨 */
.cd-labels {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.cd-label {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 3px;
  color: #fff;
  font-weight: 600;
}

/* 멤버 */
.cd-members {
  display: flex;
  gap: 4px;
  margin: 8px 0;
}
.cd-member {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* 마감일 */
.cd-due {
  font-size: 12px;
  color: var(--yellow);
  margin: 6px 0;
}
.cd-due.done { color: var(--green); }

/* 섹션 */
.cd-section {
  margin: 12px 0;
  padding-top: 8px;
  border-top: 1px solid var(--overlay);
}
.cd-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--subtext);
  margin-bottom: 8px;
}

/* 설명 */
.cd-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.cd-desc h2 {
  font-size: 14px;
  color: var(--accent);
  margin: 12px 0 4px;
  border-bottom: 1px solid var(--overlay);
  padding-bottom: 4px;
}
.cd-desc h3 { font-size: 13px; margin: 8px 0 4px; }
.cd-desc p { margin: 4px 0; }
.cd-desc ul, .cd-desc ol { margin: 4px 0; padding-left: 20px; }
.cd-desc code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-size: 12px; }

/* 체크리스트 */
.cd-checklist {
  margin: 8px 0 12px;
}
.cd-checklist-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cd-checklist-pct { color: var(--subtext); }
.cd-progress {
  height: 6px;
  background: var(--overlay);
  border-radius: 3px;
  margin-bottom: 6px;
}
.cd-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s;
}
.cd-check-item {
  display: block;
  font-size: 12px;
  padding: 3px 0;
  color: var(--text);
}
.cd-check-item.checked { color: var(--subtext); text-decoration: line-through; }
.cd-check-item input { margin-right: 6px; }

/* 첨부파일 */
.cd-attachment {
  display: block;
  font-size: 12px;
  color: var(--accent);
  padding: 4px 0;
  text-decoration: none;
}
.cd-attachment:hover { text-decoration: underline; }

/* 댓글 */
.cd-comment-input {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  align-items: flex-end;
}
.cd-comment-input textarea {
  flex: 1;
  min-height: 36px;
  resize: vertical;
}
.cd-comment-input .btn-create {
  flex-shrink: 0;
  height: 36px;
}
.cd-comments {
  max-height: 300px;
  overflow-y: auto;
}
.cd-comment {
  padding: 8px 0;
  border-bottom: 1px solid var(--overlay);
}
.cd-comment:last-child { border-bottom: none; }
.cd-comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.cd-comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.cd-comment-date {
  font-size: 11px;
  color: var(--subtext);
}
.cd-comment-body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}
.cd-comment-body p { margin: 2px 0; }

.card-detail-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--overlay);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  flex-shrink: 0;
}

/* 카드 추가 모달 */
.kanban-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.kanban-modal {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  padding: 20px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-modal h3 {
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

.kanban-input, .kanban-textarea, .kanban-select {
  background: var(--bg);
  border: 1px solid var(--overlay);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  padding: 8px;
  outline: none;
  font-family: inherit;
}

.kanban-input:focus, .kanban-textarea:focus, .kanban-select:focus {
  border-color: var(--accent);
}

.kanban-textarea {
  min-height: 60px;
  resize: vertical;
}

.kanban-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-cancel, .btn-create {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: none;
}

.btn-cancel {
  background: var(--overlay);
  color: var(--subtext);
}

.btn-create {
  background: var(--accent);
  color: var(--bg);
}

.btn-create:hover {
  opacity: 0.9;
}

/* ── UI 탭 ── */
.ui-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--overlay);
}
.ui-tab-info { display: flex; align-items: center; gap: 8px; }
.ui-tab-actions { display: flex; gap: 4px; }
.ui-port-badge {
  font-size: 11px;
  font-family: monospace;
  background: var(--overlay);
  padding: 2px 8px;
  border-radius: 3px;
  color: var(--accent);
}
.ui-status { font-size: 12px; }
.ui-status.running { color: var(--green); }
.ui-status.stopped { color: var(--subtext); }
.ui-iframe {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 400px;
  border: 1px solid var(--overlay);
  border-radius: 6px;
  background: #fff;
}
.ui-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--subtext);
  font-size: 14px;
}
.ui-containers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.ui-container {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--overlay);
  color: var(--subtext);
}
.ui-container.running { color: var(--green); }

/* ── 칸반 작업 상태 패널 ── */
.kanban-status-panel {
  padding: 6px 12px;
  background: rgba(30, 30, 46, 0.9);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  margin-bottom: 8px;
}
.ks-job {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--overlay);
}
.ks-job:last-child { border-bottom: none; }
.ks-job.done { opacity: 0.6; }
.ks-job.error { opacity: 0.6; }
.ks-icon { font-size: 14px; }
.ks-role { font-weight: 700; color: var(--accent); min-width: 40px; }
.ks-project { color: var(--subtext); min-width: 60px; }
.ks-progress { color: var(--yellow); min-width: 60px; }
.ks-job.done .ks-progress { color: var(--green); }
.ks-job.error .ks-progress { color: var(--red); }
.ks-log { color: var(--subtext); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 에이전트 알림 패널 ── */
.kanban-alerts-panel {
  margin-bottom: 8px;
  border: 1px solid var(--yellow);
  border-radius: 6px;
  background: rgba(249, 226, 175, 0.05);
  overflow: hidden;
}
.ka-header {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--yellow);
  background: rgba(249, 226, 175, 0.1);
  border-bottom: 1px solid var(--overlay);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ka-count {
  background: var(--yellow);
  color: var(--base);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
.ka-alert {
  padding: 8px 12px;
  border-bottom: 1px solid var(--overlay);
}
.ka-alert:last-child { border-bottom: none; }
.ka-alert.ka-responded { opacity: 0.5; }
.ka-alert-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-bottom: 4px;
}
.ka-icon { font-size: 14px; }
.ka-type {
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
}
.ka-action .ka-type { background: rgba(250, 179, 135, 0.2); color: var(--peach); }
.ka-choice .ka-type { background: rgba(137, 180, 250, 0.2); color: var(--blue); }
.ka-info .ka-type { background: rgba(148, 226, 213, 0.2); color: var(--teal); }
.ka-card { color: var(--subtext); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ka-age { color: var(--overlay2); font-size: 10px; }
.ka-dismiss {
  background: none;
  border: none;
  color: var(--overlay2);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}
.ka-dismiss:hover { color: var(--red); }
.ka-message {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(30, 30, 46, 0.5);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ka-respond {
  display: flex;
  gap: 4px;
}
.ka-input {
  flex: 1;
  background: var(--surface0);
  border: 1px solid var(--overlay);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}
.ka-input:focus { border-color: var(--accent); }
.ka-send {
  background: var(--accent);
  color: var(--base);
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.ka-send:hover { opacity: 0.8; }
.ka-send:disabled { opacity: 0.4; cursor: not-allowed; }
.ka-response-done {
  font-size: 11px;
  color: var(--green);
  padding: 4px 0;
}

/* ── EOS 버튼 ── */
.eos-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid var(--red);
  text-align: center;
}
.btn-eos {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 24px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-eos:hover {
  background: var(--red);
  color: var(--bg);
}

/* ── 터치 드래그앤드롭 ── */
.touch-dragging {
  opacity: 0.3;
}
.kanban-card-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.85;
  transform: rotate(3deg) scale(1.05);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.touch-drop-target {
  background: rgba(137, 180, 250, 0.1) !important;
  border: 2px dashed var(--accent) !important;
  border-radius: 8px;
}

/* ── FSD 버튼 ── */
.btn-fsd {
  background: linear-gradient(135deg, var(--accent), var(--green));
  border: none;
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-fsd:hover { opacity: 0.9; }
.btn-fsd:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-fsd.agent-running { animation: pulse 1.5s infinite; }

/* ── 칸반 에이전트 버튼 ── */
.kanban-agent-buttons {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.btn-agent {
  background: none;
  border: 1px solid var(--overlay);
  color: var(--subtext);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-agent:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-agent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-agent.agent-running {
  border-color: var(--accent);
  color: var(--accent);
  animation: pulse 1.5s infinite;
}

/* ── 카드 이동 모달 (모바일/PC 공통) ── */
.kanban-move-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.btn-move-list {
  background: var(--surface);
  border: 1px solid var(--overlay);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.btn-move-list:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-move-list.current {
  opacity: 0.4;
  cursor: default;
}

/* ── 칸반 리프레시 버튼 ── */
.btn-refresh {
  background: none;
  border: 1px solid var(--overlay);
  color: var(--subtext);
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 토스트 알림 ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--overlay);
  color: var(--text);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  border-color: var(--green);
}

.toast-error {
  border-color: var(--red);
}

/* 모바일 최적화 */
@media (max-width: 768px) {
  :root {
    --titlebar-h: 32px;
    --voice-bar-h: auto;
  }

  #voice-bar {
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px;
  }

  /* 1열: 입력창만 전체 너비 */
  .text-input {
    order: 1;
    flex-basis: 100%;
    min-width: 0;
    max-width: none;
    height: 40px;
  }

  /* 2열: 모든 버튼을 아래 줄에 배치 */
  .btn-bar-action {
    order: 2;
  }

  .btn-send {
    order: 2;
    width: 36px;
    height: 36px;
  }

  .btn-send svg {
    width: 20px;
    height: 20px;
  }

  .btn-voice {
    order: 2;
    width: 40px;
    height: 40px;
  }

  .btn-voice svg {
    width: 24px;
    height: 24px;
  }

  .voice-status {
    order: 3;
    position: static;
    flex-basis: 100%;
    text-align: center;
    font-size: 10px;
  }

  .voice-text {
    order: 4;
    flex-basis: 100%;
    max-width: 100%;
    text-align: center;
  }

  .title {
    font-size: 12px;
  }

  .menu-item {
    font-size: 11px;
    padding: 3px 8px;
  }

  .btn-icon {
    font-size: 16px;
    width: 32px;
    height: 32px;
  }

  /* 프로젝트 뷰 모바일 */
  #projects-view {
    flex-direction: column;
  }

  #project-list {
    width: 100%;
    max-height: 140px;
    border-right: none;
    border-bottom: 1px solid var(--overlay);
  }

  /* Anima 뷰 모바일 */
  #anima-view {
    flex-direction: column;
  }

  #anima-list {
    width: 100%;
    max-height: 140px;
    border-right: none;
    border-bottom: 1px solid var(--overlay);
    display: flex;
    flex-wrap: wrap;
    padding: 6px;
    gap: 4px;
    align-content: flex-start;
  }

  .anima-list-header {
    display: none;
  }

  .anima-menu-item {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--overlay);
  }

  .anima-menu-item.active {
    border-left: 1px solid var(--accent);
    border-color: var(--accent);
  }

  /* Papyrus 뷰 모바일 */
  .papyrus-view {
    flex-direction: column;
  }

  .papyrus-list {
    width: 100%;
    max-height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--overlay);
  }

  /* 메뉴가 많아지면 스크롤 가능하게 */
  .menu {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── 커스텀 Tooltip ── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--overlay);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* 하단 바 버튼은 위로 표시 (기본값과 동일하지만 명확히) */
#voice-bar [data-tooltip]::after {
  bottom: calc(100% + 8px);
}

/* 터치 기기에서는 비활성화 (title도 함께) */
@media (hover: none) {
  [data-tooltip]::after {
    display: none;
  }
}

/* ── System View ── */
#system-view {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

#system-list {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--overlay);
  overflow-y: auto;
  padding: 8px 0;
}

#system-detail {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.vessel-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--subtext);
  margin: 16px 0 8px;
}

.vessel-section-title:first-child {
  margin-top: 0;
}

.system-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.system-card {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.system-card:hover {
  border-color: var(--accent);
}

.system-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--overlay);
  font-weight: 600;
  font-size: 13px;
}

.system-card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-card-body {
  padding: 8px 14px 12px;
}

.system-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}

.system-card-label {
  color: var(--subtext);
  flex-shrink: 0;
  margin-right: 8px;
}

.system-card-value-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
  text-align: right;
}

.system-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Resources */
.system-resources {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--overlay);
}

.system-resources-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--subtext);
}

.system-resource-item {
  margin-bottom: 10px;
}

.system-resource-item:last-child {
  margin-bottom: 0;
}

.system-resource-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--subtext);
}

.system-resource-bar {
  width: 100%;
  height: 8px;
  background: var(--overlay);
  border-radius: 4px;
  overflow: hidden;
}

.system-resource-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Gauge charts */
.system-gauges { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.gauge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-svg { width: 110px; height: 110px; }
.gauge-pct { font-size: 16px; font-weight: 700; fill: var(--text); text-anchor: middle; dominant-baseline: auto; }
.gauge-label { font-size: 10px; fill: var(--subtext); text-anchor: middle; dominant-baseline: auto; text-transform: uppercase; letter-spacing: 0.5px; }
.gauge-detail { font-size: 11px; color: var(--subtext); text-align: center; }

/* Architecture diagram */
.system-arch {
  overflow: auto;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.system-arch svg {
  max-width: 100%;
  height: auto;
}

.system-node rect {
  fill: var(--surface);
  stroke-width: 2;
}

.system-node-external rect {
  fill: var(--overlay);
  stroke-dasharray: 6 3;
}

.system-node-storage rect {
  fill: #1e1e3e;
}

.system-node-text {
  fill: var(--text);
  font-size: 11px;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: -apple-system, 'Segoe UI', sans-serif;
}

.system-conn {
  stroke: var(--overlay);
  stroke-width: 1.5;
  fill: none;
}

.system-conn-label {
  fill: var(--subtext);
  font-size: 10px;
  text-anchor: middle;
  font-family: -apple-system, 'Segoe UI', sans-serif;
}

/* ── Logs Tab ── */
.log-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.log-select {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.log-select:focus { border-color: var(--accent); }

.log-filter {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  flex: 1;
  min-width: 120px;
  outline: none;
}

.log-filter:focus { border-color: var(--accent); }
.log-filter::placeholder { color: var(--subtext); }

.log-btn {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.log-btn:hover { border-color: var(--accent); background: var(--overlay); }
.log-btn.active { border-color: var(--accent); background: var(--accent); color: var(--bg); }

.log-output {
  background: #11111b;
  border: 1px solid var(--overlay);
  border-radius: 8px;
  padding: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11.5px;
  line-height: 1.5;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line {
  padding: 1px 4px;
  border-radius: 2px;
}

.log-line:hover { background: rgba(255,255,255,0.04); }

.log-error { color: #f38ba8; }
.log-warn { color: #fab387; }
.log-info { color: #89b4fa; }
.log-debug { color: #6c7086; }
.log-dim { color: var(--subtext); font-style: italic; }

.log-highlight {
  background: rgba(249, 226, 175, 0.3);
  color: #f9e2af;
  border-radius: 2px;
  padding: 0 1px;
}

.system-log-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.system-log-link:hover { opacity: 1; text-decoration: underline; }

/* ── Premier 뷰 ── */
#premier-view {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

#premier-list {
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--overlay);
  overflow-y: auto;
  padding: 8px 0;
}

#premier-detail {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

/* Premier sections */
.premier-section {
  margin-bottom: 20px;
}

.premier-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--subtext);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--overlay);
}

.premier-empty {
  font-size: 12px;
  color: var(--green);
  padding: 8px 0;
}

/* Premier table */
.premier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.premier-table th {
  text-align: left;
  color: var(--subtext);
  font-weight: 500;
  padding: 6px 10px;
  border-bottom: 1px solid var(--overlay);
}

.premier-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(49, 50, 68, 0.4);
}

.premier-table tr:hover td {
  background: rgba(49, 50, 68, 0.3);
}

/* Premier incidents */
.premier-incident {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(49, 50, 68, 0.4);
}

.premier-incident-name {
  font-weight: 600;
  color: var(--text);
}

.premier-incident-msg {
  color: var(--subtext);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Premier bar */
.premier-bar-container {
  max-width: 400px;
}

.premier-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--subtext);
  margin-bottom: 6px;
}

/* Premier info grid */
.premier-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.premier-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--overlay);
  font-size: 12px;
}

/* Priority badges */
.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.priority-high {
  background: rgba(243, 139, 168, 0.15);
  color: var(--red);
  border: 1px solid rgba(243, 139, 168, 0.3);
}

.priority-medium {
  background: rgba(249, 226, 175, 0.15);
  color: #f9e2af;
  border: 1px solid rgba(249, 226, 175, 0.3);
}

.priority-low {
  background: rgba(166, 227, 161, 0.15);
  color: var(--green);
  border: 1px solid rgba(166, 227, 161, 0.3);
}

/* ── 칸반 보드 ── */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 60vh;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--overlay);
  flex-shrink: 0;
}

.kanban-column-count {
  background: var(--overlay);
  color: var(--subtext);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.kanban-column-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  padding: 10px;
  transition: border-color 0.15s;
}

.kanban-card:hover {
  border-color: var(--accent);
}

.kanban-card-top {
  margin-bottom: 6px;
}

.kanban-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.kanban-card-desc {
  font-size: 11px;
  color: var(--subtext);
  margin-top: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-empty {
  font-size: 11px;
  color: var(--subtext);
  text-align: center;
  padding: 16px 0;
}

/* Kanban stats */
.kanban-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.kanban-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--overlay);
  font-size: 12px;
}

.kanban-stat-value {
  font-weight: 700;
  color: var(--accent);
}

.kanban-stat-dist {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.kanban-stat-tag {
  padding: 3px 10px;
  background: var(--overlay);
  border-radius: 10px;
  font-size: 11px;
  color: var(--subtext);
}

.detail-subtitle {
  font-size: 11px;
  color: var(--subtext);
  margin-left: 12px;
}

/* ── Premier 반응형 ── */
@media (max-width: 768px) {
  #premier-list {
    width: 140px;
  }

  #premier-detail {
    padding: 12px 16px;
  }

  .kanban-board {
    flex-direction: column;
  }

  .kanban-column {
    max-width: none;
    max-height: 300px;
  }

  .premier-info-grid {
    grid-template-columns: 1fr;
  }
}
