/* 문돌실장 Web UI — 다크 테마 */

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #222537;
  --border: #2d3148;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent: #6366f1;
  --accent2: #818cf8;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --card-shadow: 0 4px 16px rgba(0,0,0,0.4);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── 유틸 ── */
.hidden { display: none !important; }
.loading { color: var(--text3); padding: 24px; text-align: center; }

/* ── 로그인 화면 ── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 360px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-subtitle { color: var(--text3); font-size: 13px; margin-bottom: 32px; }

.login-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--accent2); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
}

/* ── 앱 레이아웃 ── */
.app-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ── 사이드바 ── */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { font-size: 24px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--accent); color: white; }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text3);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.error { background: var(--danger); }

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-avatar { font-size: 18px; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  align-self: flex-start;
  background: var(--bg3);
  color: var(--text3);
}
.user-role.admin { background: rgba(99,102,241,0.2); color: var(--accent2); }

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text3);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ── 메인 영역 ── */
.main-area {
  overflow-y: auto;
  min-height: 100vh;
}

.panel { padding: 28px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.refresh-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── 요약 카드 ── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.card-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.card-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

/* ── 섹션 타이틀 ── */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── 봇 카드 ── */
.bot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.bot-cards.large {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.bot-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s;
  position: relative;
}

.bot-card:hover { border-color: var(--accent); }
.bot-card.status-active { border-left: 3px solid var(--success); }
.bot-card.status-inactive { border-left: 3px solid var(--danger); }
.bot-card.status-unknown { border-left: 3px solid var(--text3); }

.bot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bot-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.bot-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge-active { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-inactive { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-unknown { background: rgba(100,116,139,0.15); color: var(--text3); }

.bot-host {
  font-size: 11px;
  color: var(--text3);
  font-family: monospace;
  margin-bottom: 8px;
}

.bot-meta {
  font-size: 11px;
  color: var(--text3);
}

/* ── 봇 시스템 메트릭 ── */
.bot-metrics {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-row { }

.metric-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 3px;
}

.metric-label-row .metric-name { font-weight: 600; color: var(--text2); }

.metric-bar-wrap {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.metric-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.metric-bar.ok     { background: var(--success); }
.metric-bar.warn   { background: var(--warn); }
.metric-bar.danger { background: var(--danger); }

.metric-info-row {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}

.metric-info-row span { display: flex; align-items: center; gap: 3px; }

.metric-error {
  font-size: 10px;
  color: var(--text3);
  margin-top: 6px;
  font-style: italic;
}

.bot-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.btn-sm {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── 스케줄 테이블 ── */
.schedule-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.filter-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

.table-wrap { overflow-x: auto; }

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.schedule-table th {
  background: var(--bg3);
  color: var(--text3);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.schedule-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.schedule-table tr:hover td { background: var(--bg3); }

.job-name { font-family: monospace; color: var(--info); font-size: 12px; }
.job-enabled { color: var(--success); }
.job-disabled { color: var(--text3); }

.badge-type {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-daily { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-weekly { background: rgba(56,189,248,0.15); color: var(--info); }
.badge-monthly { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge-interval { background: rgba(34,197,94,0.15); color: var(--success); }

/* ── 로그 뷰어 ── */
.log-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.log-controls select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.log-viewer {
  background: #0a0c14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #a0b0c0;
  padding: 16px;
  height: calc(100vh - 200px);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line { border-bottom: none; }
.log-line.error { color: #ff6b6b; }
.log-line.warn { color: #ffd93d; }

/* ── 세션 목록 ── */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.session-item:hover { border-color: var(--accent); }

.session-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.session-meta { font-size: 12px; color: var(--text3); }

/* ── 메모리 뷰어 ── */
.memory-viewer {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 13px;
  line-height: 1.7;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.memory-viewer h1 { font-size: 20px; color: var(--text); margin: 0 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.memory-viewer h2 { font-size: 16px; color: var(--accent2); margin: 16px 0 8px; }
.memory-viewer a { color: var(--info); text-decoration: none; }
.memory-viewer a:hover { text-decoration: underline; }
.memory-viewer li { margin: 4px 0 4px 16px; color: var(--text2); }
.memory-viewer code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--info); font-size: 12px; }

/* ── 반응형 ── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; border-right: none; border-top: 1px solid var(--border); z-index: 100; }
  .sidebar-header, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; padding: 8px; gap: 4px; overflow-x: auto; }
  .nav-btn { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 10px; min-width: 56px; }
  .main-area { margin-bottom: 80px; }
  .panel { padding: 16px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .bot-cards { grid-template-columns: 1fr; }
}

/* ── 채팅 패널 ── */
.panel-chat {
  padding: 0 !important;
  height: calc(100vh - 0px);
  display: flex;
  flex-direction: column;
}

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  overflow: hidden;
}

/* 세션 사이드바 */
.chat-session-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-session-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.btn-new-chat {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-new-chat:hover { background: var(--accent2); }

.chat-session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.chat-session-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.chat-session-item:hover { background: var(--bg3); }
.chat-session-item.active { background: var(--bg3); border-left: 3px solid var(--accent); }
.chat-session-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-item-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
}

/* 채팅 영역 */
.chat-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

/* 환영 화면 */
.chat-welcome {
  text-align: center;
  padding: 80px 24px;
}
.chat-welcome-icon { font-size: 48px; margin-bottom: 16px; }
.chat-welcome-text { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.chat-welcome-sub { font-size: 13px; color: var(--text3); }

/* 메시지 버블 */
.msg-bubble {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.msg-bubble.user { align-items: flex-end; }
.msg-bubble.assistant { align-items: flex-start; }

.msg-role {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 4px;
  font-weight: 500;
}

.msg-content {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
  max-width: 85%;
  word-break: break-word;
}

.msg-bubble.user .msg-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble.assistant .msg-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-content code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.msg-content pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.msg-content pre code {
  background: none;
  padding: 0;
}

.msg-content p { margin: 4px 0; }
.msg-content ul, .msg-content ol { margin: 4px 0 4px 20px; }

/* 툴 호출 표시 */
.msg-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text3);
  max-width: 60%;
}
.msg-tool-icon { font-size: 14px; }

/* 스트리밍 커서 */
.streaming-cursor::after {
  content: '▌';
  color: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 입력 바 */
.chat-input-bar {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 12px 20px;
  flex-shrink: 0;
}

.chat-workspace-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-workspace-label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}

.chat-workspace-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text2);
  font-size: 11px;
  font-family: monospace;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s;
  max-height: 160px;
  overflow-y: auto;
}
.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-btn-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-send:hover { background: var(--accent2); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-cancel {
  background: var(--bg3);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.btn-cancel:hover { background: var(--danger); color: #fff; }

/* 에러 메시지 */
.chat-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--danger);
  font-size: 13px;
  margin: 4px 0;
}

/* ── 봇 통신 패널 (bot_bus) ── */
.botbus-summary-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.botbus-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 90px;
  text-align: center;
  flex: 1;
}
.botbus-stat-card.urgent { border-color: rgba(239,68,68,0.5); }
.botbus-stat-card.high   { border-color: rgba(245,158,11,0.5); }
.botbus-stat-card.normal { border-color: rgba(56,189,248,0.5); }
.botbus-stat-card.low    { border-color: var(--border); }

.botbus-stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.botbus-stat-card.urgent .botbus-stat-num { color: var(--danger); }
.botbus-stat-card.high   .botbus-stat-num { color: var(--warn); }
.botbus-stat-card.normal .botbus-stat-num { color: var(--info); }

.botbus-stat-label { font-size: 11px; color: var(--text3); margin-top: 4px; }

.botbus-bot-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.botbus-bot-badge {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.botbus-bot-badge.has-unread { border-color: var(--accent); color: var(--text); }
.botbus-bot-badge .bb-count {
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}
.botbus-bot-badge.urgent-bot { border-color: var(--danger); }
.botbus-bot-badge.urgent-bot .bb-count { background: var(--danger); }

.botbus-filter-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.botbus-filter-group { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: 11px; color: var(--text3); margin-right: 2px; white-space: nowrap; }

.botbus-main {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 14px;
  height: calc(100vh - 340px);
  min-height: 400px;
}

.botbus-feed-col,
.botbus-detail-col {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.botbus-feed-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.live-dot {
  font-size: 11px;
  color: var(--success);
  animation: blink 2s infinite;
}
.live-dot.offline { color: var(--danger); animation: none; }

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

.botbus-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.bb-msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  background: var(--bg3);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}
.bb-msg:hover { background: #2a2d3e; border-left-color: var(--accent); }
.bb-msg.selected { background: #2a2d3e; border-left-color: var(--accent); outline: 1px solid var(--accent); }
.bb-msg.pri-urgent { border-left-color: var(--danger); }
.bb-msg.pri-high   { border-left-color: var(--warn); }
.bb-msg.pri-normal { border-left-color: var(--info); }
.bb-msg.pri-low    { border-left-color: var(--border); opacity: 0.75; }
.bb-msg.handled    { opacity: 0.55; }

.bb-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.bb-msg-route {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.bb-msg-pri {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.bb-msg-pri.urgent { background: rgba(239,68,68,0.2); color: var(--danger); }
.bb-msg-pri.high   { background: rgba(245,158,11,0.2); color: var(--warn); }
.bb-msg-pri.normal { background: rgba(56,189,248,0.2); color: var(--info); }
.bb-msg-pri.low    { background: var(--bg); color: var(--text3); }

.bb-msg-ts { font-size: 10px; color: var(--text3); margin-left: auto; }
.bb-msg-subject { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.bb-msg-body { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-msg-handled-badge {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 10px;
  color: var(--success);
}

.bb-msg-new {
  animation: bb-flash 1s ease-out;
}
@keyframes bb-flash {
  from { background: rgba(99,102,241,0.3); }
  to   { background: var(--bg3); }
}

.botbus-detail {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.botbus-detail-empty {
  color: var(--text3);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}

.bb-detail-route {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bb-detail-subject {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}
.bb-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.bb-detail-chip {
  font-size: 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  color: var(--text2);
}
.bb-detail-body {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  margin-bottom: 14px;
}
.bb-detail-status {
  font-size: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.bb-detail-status.handled {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--success);
}
.bb-detail-status.unread {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--warn);
}
.bb-detail-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.botbus-offline {
  text-align: center;
  padding: 60px 24px;
}
.botbus-offline-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.botbus-offline-title { font-size: 18px; font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.botbus-offline-desc {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.7;
  margin-bottom: 16px;
}
.botbus-offline-cmd {
  display: inline-block;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--info);
  line-height: 2;
}

.nav-badge {
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  margin-left: auto;
}

/* 2026-05-17 외부 서비스 통합 네비 */
.nav-section-divider {
  height: 1px; background: var(--border, #2a2a2a); margin: 12px 16px;
}
.nav-section-label {
  font-size: 11px; color: var(--text-muted, #888); padding: 4px 20px 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.nav-btn-external {
  display: flex; align-items: center; padding: 10px 20px;
  color: var(--text, #e0e0e0); text-decoration: none;
  background: transparent; border: none; cursor: pointer;
  font-size: 14px; transition: background 0.15s;
}
.nav-btn-external:hover {
  background: var(--hover, rgba(255,255,255,0.05));
}
.nav-btn-external .nav-icon { margin-right: 10px; }
.nav-btn-external .nav-icon-external {
  margin-left: auto; opacity: 0.5; font-size: 12px;
}
