:root {
  --bg: #0a0d16;
  --bg2: #0f1320;
  --bg3: #141928;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-active: rgba(99,179,237,0.45);
  --text: #e2e8f0;
  --text-muted: #4a5568;
  --text-dim: #718096;
  --accent: #63b3ed;
  --accent2: #9f7aea;
  --accent-glow: rgba(99,179,237,0.12);
  --green: #48bb78;
  --yellow: #ecc94b;
  --red: #fc8181;
  --teal: #4fd1c5;
  --sidebar-w: 268px;
  --radius: 10px;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(99,179,237,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,179,237,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
}
body { display: flex; position: relative; z-index: 1; }

/* ========== サイドバー ========== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  height: 100vh; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; box-shadow: 0 0 14px rgba(99,102,241,0.25); flex-shrink: 0;
}
.logo-title { font-size: 13px; font-weight: 700; }
.logo-sub   { font-size: 10px; color: var(--text-muted); }
.new-chat-btn {
  margin-left: auto; width: 28px; height: 28px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  border: none; border-radius: 7px; color: white;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); line-height: 1;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.new-chat-btn:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(59,130,246,0.45); }

/* メモリバー */
.memory-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  background: linear-gradient(90deg, rgba(79,209,197,0.08), rgba(99,179,237,0.06));
  border-bottom: 1px solid rgba(79,209,197,0.15);
  flex-shrink: 0;
}
.memory-icon { font-size: 13px; }
.memory-text { font-size: 10.5px; color: var(--teal); flex: 1; }
.memory-btn {
  font-size: 10px; padding: 2px 7px;
  background: rgba(79,209,197,0.12); border: 1px solid rgba(79,209,197,0.3);
  border-radius: 5px; color: var(--teal); cursor: pointer; transition: all var(--transition);
}
.memory-btn:hover { background: rgba(79,209,197,0.22); }

/* セクションラベル */
.sidebar-section-label {
  padding: 10px 12px 3px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-section-flex { display: flex; align-items: center; justify-content: space-between; padding-right: 12px; }
.history-count { font-size: 10px; color: var(--text-muted); background: var(--surface); border-radius: 10px; padding: 1px 7px; }

/* ========== ペルソナカード ========== */
.persona-list { display: flex; flex-direction: column; gap: 1px; padding: 3px 7px; flex-shrink: 0; }

.persona-card {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--radius);
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); position: relative;
}
.persona-card:hover { background: var(--surface-hover); border-color: var(--border); }
.persona-card.active {
  background: linear-gradient(135deg, rgba(99,179,237,0.1), rgba(159,122,234,0.07));
  border-color: var(--border-active);
}
.persona-card.active::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; background: linear-gradient(to bottom, var(--accent), var(--accent2));
  border-radius: 0 2px 2px 0;
}
.persona-icon-wrap {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.persona-card.active .persona-icon-wrap {
  background: linear-gradient(135deg, rgba(99,179,237,0.18), rgba(159,122,234,0.12));
  border-color: var(--border-active);
}
.persona-info { flex: 1; min-width: 0; }
.persona-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona-model-badge { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.persona-card.active .persona-model-badge { color: var(--accent); }

/* ========== チャット履歴リスト ========== */
.chat-history-list {
  flex: 1; overflow-y: auto; padding: 3px 7px;
  display: flex; flex-direction: column; gap: 1px;
  min-height: 60px; max-height: 220px;
}
.chat-history-list::-webkit-scrollbar { width: 3px; }
.chat-history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-loading { font-size: 11px; color: var(--text-muted); padding: 8px 10px; }
.history-empty   { font-size: 11px; color: var(--text-muted); padding: 8px 10px; font-style: italic; }

.history-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); position: relative;
}
.history-item:hover { background: var(--surface-hover); border-color: var(--border); }
.history-item:hover .history-delete { opacity: 1; }
.history-item.active { background: var(--surface); border-color: var(--border-active); }

.history-icon { font-size: 12px; flex-shrink: 0; color: var(--text-muted); }
.history-info { flex: 1; min-width: 0; }
.history-title {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.history-meta { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.history-delete {
  opacity: 0; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 4px; border-radius: 4px; font-size: 12px;
  transition: all var(--transition); flex-shrink: 0;
}
.history-delete:hover { color: var(--red); background: rgba(252,129,129,0.1); }

/* ========== ワークスペース ========== */
.workspace-header { display: flex; align-items: center; justify-content: space-between; padding-right: 8px; flex-shrink: 0; }
.workspace-change-btn {
  font-size: 10px; padding: 3px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-dim); cursor: pointer; transition: all var(--transition);
}
.workspace-change-btn:hover { background: var(--surface-hover); color: var(--accent); border-color: var(--border-active); }
.file-path-display { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: var(--accent); padding: 3px 12px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.file-list { flex: 0 1 120px; overflow-y: auto; padding: 0 7px; }
.file-list::-webkit-scrollbar { width: 3px; }
.file-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.file-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 7px; cursor: pointer;
  font-size: 11px; color: var(--text-dim);
  transition: all var(--transition); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-item:hover { background: var(--surface-hover); color: var(--text); }
.file-item.ctx-active { background: rgba(236,201,75,0.08); color: var(--yellow); }
.file-icon { font-size: 12px; flex-shrink: 0; }

/* ========== サイドバーフッター ========== */
.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); flex-shrink: 0;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); transition: all var(--transition); flex-shrink: 0; }
.status-dot.ok   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.warn { background: var(--yellow); }
.status-dot.err  { background: var(--red); }
.memory-indicator { margin-left: auto; font-size: 10px; color: var(--teal); }
.auto-save-status {
  margin-left: auto; font-size: 9.5px; color: var(--green);
  opacity: 0; transition: opacity 0.4s ease;
  white-space: nowrap;
}
.auto-save-status.visible { opacity: 1; }

/* ========== メインエリア ========== */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* トップバー */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--bg2); flex-shrink: 0;
}
.cockpit-status { display: flex; align-items: center; gap: 9px; }
.cockpit-persona {
  font-size: 13px; font-weight: 700; padding: 3px 11px;
  background: linear-gradient(135deg, rgba(99,179,237,0.16), rgba(159,122,234,0.1));
  border: 1px solid var(--border-active); border-radius: 20px;
}
.cockpit-arrow { color: var(--text-muted); font-size: 11px; }
.cockpit-model {
  font-size: 12.5px; font-weight: 500; color: var(--accent); padding: 3px 11px;
  background: rgba(99,179,237,0.07); border: 1px solid rgba(99,179,237,0.2); border-radius: 20px;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ユーザーアバター設定 */
.avatar-setting { position: relative; display: flex; align-items: center; }
.avatar-upload-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 16px; cursor: pointer; transition: all var(--transition);
  overflow: hidden; padding: 0;
}
.avatar-upload-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-btn:hover { border-color: rgba(59,130,246,0.6); box-shadow: 0 0 10px rgba(59,130,246,0.2); }

.file-context-badge {
  display: flex; align-items: center; gap: 5px; padding: 4px 10px;
  background: rgba(236,201,75,0.1); border: 1px solid rgba(236,201,75,0.3);
  border-radius: 20px; font-size: 12px; color: var(--yellow);
}
.badge-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 11px; padding: 0; opacity: 0.6; }
.badge-close:hover { opacity: 1; }
.btn-attach, .btn-save-chat {
  padding: 5px 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; color: var(--text-dim);
  cursor: pointer; transition: all var(--transition);
}
.btn-attach:hover, .btn-save-chat:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-active); }

/* ========== チャットエリア ========== */
.chat-area { flex: 1; overflow-y: auto; padding: 22px 20px; display: flex; flex-direction: column; gap: 18px; }
.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ウェルカム画面 */
.welcome-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; height: 100%; text-align: center; padding: 40px;
}
.welcome-icon { font-size: 56px; line-height: 1; }
.welcome-title { font-size: 24px; font-weight: 700; background: linear-gradient(135deg, var(--accent), #b794f4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.welcome-sub { color: var(--text-dim); font-size: 13.5px; line-height: 1.8; }
.memory-note {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 16px; font-size: 12px; color: var(--teal);
  background: rgba(79,209,197,0.08); border: 1px solid rgba(79,209,197,0.2);
  border-radius: 20px;
}
.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.quick-prompt {
  padding: 7px 15px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; color: var(--text-dim);
  cursor: pointer; transition: all var(--transition);
}
.quick-prompt:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-active); }

/* メッセージ */
.messages { display: flex; flex-direction: column; gap: 18px; }
.message { display: flex; gap: 12px; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 33px; height: 33px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.message.user .msg-avatar { background: linear-gradient(135deg, #3b82f6, #7c3aed); }

/* カスタムユーザーアイコン */
.message.user .msg-avatar.user-avatar-custom {
  background: transparent; border-radius: 50%; border: 1px solid rgba(59,130,246,0.4);
  padding: 0; overflow: hidden; font-size: 0;
}
.message.user .msg-avatar.user-avatar-custom img { width: 100%; height: 100%; object-fit: cover; }

.message.assistant .msg-avatar { background: var(--bg3); border: 1px solid var(--border); }

/* ========== ツール承認パネル ========== */
.tool-approval-card {
  margin-top: 12px;
  background: rgba(99,179,237,0.06); border: 1px solid rgba(99,179,237,0.3);
  border-radius: 10px; overflow: hidden;
}
.tool-card-header {
  background: rgba(99,179,237,0.12); padding: 8px 14px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid rgba(99,179,237,0.2);
}
.tool-card-body { padding: 12px 14px; font-size: 11.5px; color: var(--text); font-family: 'JetBrains Mono', monospace; word-break: break-all; }
.tool-card-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  background: rgba(0,0,0,0.2); border-top: 1px solid rgba(255,255,255,0.05);
}
.tool-btn {
  flex: 1; padding: 8px 0; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--transition);
}
.tool-btn.reject { background: rgba(252,129,129,0.1); color: var(--red); border: 1px solid rgba(252,129,129,0.3); }
.tool-btn.reject:hover { background: rgba(252,129,129,0.2); }
.tool-btn.approve { background: linear-gradient(135deg, #3b82f6, #7c3aed); color: white; box-shadow: 0 2px 8px rgba(59,130,246,0.3); }
.tool-btn.approve:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.45); }
.tool-rejected { padding: 12px; font-size: 12px; color: var(--red); font-weight: 600; text-align: center; }
.tool-executing { padding: 12px; font-size: 12px; color: var(--accent); font-weight: 600; text-align: center; }
.tool-success { padding: 12px; font-size: 12px; color: var(--green); background: rgba(72,187,120,0.1); }
.tool-success pre { background: rgba(0,0,0,0.3); padding: 8px; margin-top: 6px; border-radius: 6px; font-size: 11px; }
.tool-error { padding: 12px; font-size: 12px; color: var(--red); background: rgba(252,129,129,0.1); }

.msg-content { max-width: 78%; display: flex; flex-direction: column; gap: 3px; }
.msg-meta { font-size: 10px; color: var(--text-muted); }
.message.user .msg-meta { text-align: right; }
.msg-bubble {
  padding: 11px 15px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.75; word-break: break-word;
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, #1d4ed8, #5b21b6);
  border-radius: var(--radius) var(--radius) 4px var(--radius);
}
.message.assistant .msg-bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
}
.msg-bubble pre { background: rgba(0,0,0,0.45); border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; overflow-x: auto; margin: 10px 0; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.msg-bubble code { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 6px 18px; }
.msg-bubble li { margin: 3px 0; }
.msg-bubble h1,.msg-bubble h2,.msg-bubble h3 { margin: 10px 0 5px; font-size: 14px; }
.msg-bubble strong { color: var(--accent); }
.msg-bubble p { margin: 4px 0; }

.typing-indicator { display: flex; gap: 5px; align-items: center; padding: 2px 0; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ========== 入力エリア ========== */
.input-area { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg2); flex-shrink: 0; }
.custom-model-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; margin-bottom: 8px;
  background: rgba(159,122,234,0.07); border: 1px solid rgba(159,122,234,0.22); border-radius: var(--radius);
}
.custom-model-label { font-size: 12px; color: var(--accent2); white-space: nowrap; }
.custom-model-select {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 12px; padding: 5px 10px; outline: none; cursor: pointer;
}
.custom-model-select:focus { border-color: var(--border-active); }
.custom-model-loading { font-size: 12px; color: var(--text-muted); }
.input-box {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; transition: border-color var(--transition);
}
.input-box:focus-within { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-box textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: 'Inter', sans-serif;
  resize: none; max-height: 160px; line-height: 1.6;
}
.input-box textarea::placeholder { color: var(--text-muted); }
.btn-send {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  border: none; border-radius: 8px; cursor: pointer; color: white;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); box-shadow: 0 3px 10px rgba(59,130,246,0.3); flex-shrink: 0;
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(59,130,246,0.4); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.input-hint { font-size: 10.5px; color: var(--text-muted); text-align: center; margin-top: 6px; }

/* ========== モーダル共通 ========== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(5px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; width: 500px; max-width: 92vw;
  max-height: 76vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 4px; transition: all var(--transition); }
.modal-close:hover { color: var(--text); background: var(--surface-hover); }
.modal-path { padding: 7px 18px; font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--accent); background: rgba(99,179,237,0.06); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-file-list { flex: 1; overflow-y: auto; padding: 6px; }
.modal-file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all var(--transition); }
.modal-file-item:hover { background: var(--surface-hover); }

/* メモリ詳細モーダル */
.memory-detail-modal { width: 640px; }
.memory-file-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.memory-file-item { background: var(--bg3); border: 1px solid rgba(79,209,197,0.2); border-radius: 10px; overflow: hidden; }
.memory-file-header { padding: 9px 14px; background: rgba(79,209,197,0.07); font-size: 12px; font-weight: 600; color: var(--teal); font-family: 'JetBrains Mono', monospace; }
.memory-file-content { padding: 12px 14px; font-size: 12px; color: var(--text-dim); line-height: 1.7; white-space: pre-wrap; max-height: 200px; overflow-y: auto; }

/* ワークスペースモーダル */
.workspace-modal .modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-label { font-size: 12px; color: var(--text-dim); }
.modal-input { width: 100%; padding: 9px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-family: 'JetBrains Mono', monospace; outline: none; transition: border-color var(--transition); }
.modal-input:focus { border-color: var(--border-active); }
.workspace-shortcuts { display: flex; flex-direction: column; gap: 5px; }
.ws-label { font-size: 11px; color: var(--text-muted); }
.ws-shortcut { padding: 7px 12px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); font-size: 12px; cursor: pointer; transition: all var(--transition); }
.ws-shortcut:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-active); }
.modal-apply-btn { padding: 10px 16px; background: linear-gradient(135deg, #3b82f6, #7c3aed); border: none; border-radius: 8px; color: white; font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); box-shadow: 0 3px 10px rgba(59,130,246,0.25); }
/* ========== テキストエリア ==========
 * (previous content continues above this point) */
.modal-apply-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(59,130,246,0.35); }

/* ========== 出力保存先バー ========== */
.output-folder-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(79,209,197,0.07); border: 1px solid rgba(79,209,197,0.2);
  border-radius: 8px; font-size: 11px;
}
.output-folder-icon { font-size: 12px; }
.output-folder-path { font-family: 'JetBrains Mono', monospace; color: var(--teal); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-folder-btn {
  padding: 2px 8px; font-size: 10px;
  background: rgba(79,209,197,0.12); border: 1px solid rgba(79,209,197,0.3);
  border-radius: 5px; color: var(--teal); cursor: pointer; transition: all var(--transition);
}
.output-folder-btn:hover { background: rgba(79,209,197,0.22); }

/* ========== 画像生成バー ========== */
.image-gen-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(255,170,0,0.07), rgba(255,100,150,0.05));
  border: 1px solid rgba(255,170,0,0.25); border-radius: var(--radius);
  flex-shrink: 0;
}
.image-gen-label { font-size: 12px; color: #f6ad55; white-space: nowrap; }
.aspect-select {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 12px; padding: 4px 10px; outline: none; cursor: pointer;
}
.aspect-select:focus { border-color: rgba(255,170,0,0.5); }
.image-gen-hint { font-size: 10.5px; color: var(--text-muted); margin-left: auto; }

/* ========== チャット内インライン画像 ========== */
.msg-image {
  max-width: 100%; width: auto; max-height: 420px;
  border-radius: 10px; display: block; margin: 4px 0;
  cursor: pointer; transition: opacity var(--transition);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.msg-image:hover { opacity: 0.92; }
.msg-image-info {
  margin-top: 8px; font-size: 11.5px; color: var(--text-dim); line-height: 1.7;
}
.msg-image-info code { font-family: 'JetBrains Mono', monospace; color: var(--accent); font-size: 11px; }
.save-path { color: var(--teal); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }

/* ツール実行ログのアコーディオン用スタイル */
.tool-log-details {
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.tool-log-details summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 0.85em;
  font-family: monospace;
  color: #a0a0a0;
  user-select: none;
}
.tool-log-details summary:hover {
  background: rgba(255, 255, 255, 0.05);
}
.tool-log-content {
  padding: 10px;
  font-size: 0.8em;
  font-family: monospace;
  color: #888;
  background: rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

/* ========== 放置モード（Autopilot）バー ========== */
.autopilot-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  margin-bottom: 8px;
  background: rgba(79, 209, 197, 0.06);
  border: 1px solid rgba(79, 209, 197, 0.22);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.autopilot-bar.running {
  background: rgba(236, 201, 75, 0.08);
  border-color: rgba(236, 201, 75, 0.35);
  box-shadow: 0 0 10px rgba(236, 201, 75, 0.1);
}
.autopilot-label {
  font-size: 12px;
  color: var(--teal);
  font-weight: 500;
  transition: color var(--transition);
}
.autopilot-bar.running .autopilot-label {
  color: var(--yellow);
  animation: autopilotPulse 1.8s infinite;
}
@keyframes autopilotPulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

/* トグルスイッチスタイル */
.autopilot-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.autopilot-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.autopilot-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg3);
  border: 1px solid var(--border);
  transition: .2s;
  border-radius: 20px;
}
.autopilot-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-dim);
  transition: .2s;
  border-radius: 50%;
}
.autopilot-switch input:checked + .autopilot-slider {
  background-color: var(--teal);
  border-color: var(--teal);
}
.autopilot-switch input:checked + .autopilot-slider:before {
  transform: translateX(18px);
  background-color: white;
}
.autopilot-bar.running .autopilot-switch input:checked + .autopilot-slider {
  background-color: var(--yellow);
  border-color: var(--yellow);
}

.btn-stop-autopilot {
  margin-left: auto;
  padding: 4px 10px;
  background: rgba(252, 129, 129, 0.15);
  border: 1px solid rgba(252, 129, 129, 0.4);
  border-radius: 6px;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-stop-autopilot:hover {
  background: rgba(252, 129, 129, 0.3);
  box-shadow: 0 0 8px rgba(252, 129, 129, 0.2);
}

/* ========== 自己変容診断モーダル ========== */
.uranai-modal {
  width: 800px;
  max-width: 95vw;
  max-height: 90vh;
}
.uranai-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.uranai-modal .modal-body::-webkit-scrollbar {
  width: 6px;
}
.uranai-modal .modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.uranai-form-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.uranai-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}
.uranai-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .uranai-grid-2 {
    grid-template-columns: 1fr;
  }
}
.uranai-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.uranai-input-group label {
  font-size: 11.5px;
  color: var(--text-dim);
}
.uranai-question-card {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.uranai-question-card:last-child {
  border-bottom: none;
}
.uranai-q-text {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.uranai-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.uranai-option-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.uranai-option-label:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.uranai-option-label input[type="radio"] {
  margin-top: 3px;
  cursor: pointer;
}
.uranai-option-label.selected {
  background: rgba(99, 179, 237, 0.08);
  border-color: rgba(99, 179, 237, 0.25);
  color: var(--accent);
}
.uranai-progress-bar-container {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.uranai-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s ease;
}
/* 診断結果表示 */
.uranai-result-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.uranai-scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 600px) {
  .uranai-scores-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.uranai-score-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.uranai-score-label {
  font-size: 11px;
  color: var(--text-dim);
}
.uranai-score-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent2);
  margin-top: 4px;
}
.uranai-md-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 13.5px;
  line-height: 1.75;
  overflow-y: auto;
  max-height: 400px;
  white-space: pre-wrap;
}
.uranai-result-header {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 4px;
}
.uranai-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
}
.uranai-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 自己変容診断 履歴タブ＆履歴リスト補強 ========== */
.uranai-tab {
  transition: all var(--transition);
}
.uranai-tab:hover {
  color: var(--text) !important;
}
.uranai-history-card {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: fadeIn 0.2s ease;
}
.uranai-history-card:hover {
  box-shadow: 0 6px 16px rgba(99,179,237,0.08);
}
.uranai-history-delete-btn {
  transition: all var(--transition);
}
.uranai-history-delete-btn:hover {
  transform: scale(1.1);
}
