/* ============================================
   CTT Knowledge - Style v10
   Modern gradient design
   ============================================ */

:root {
  --c-bg: #f0f4f9;
  --c-surface: #ffffff;
  --c-surface-hover: #f8fafc;
  --c-border: #e1e6ef;
  --c-border-light: #edf1f7;

  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #94a3b8;

  --c-primary: #3b82f6;
  --c-primary-hover: #2563eb;
  --c-primary-light: #eff6ff;
  --c-primary-subtle: #dbeafe;

  --c-accent: #8b5cf6;
  --c-accent-light: #f5f3ff;

  --c-success: #10b981;
  --c-success-light: #ecfdf5;
  --c-warning: #f59e0b;
  --c-warning-light: #fffbeb;
  --c-error: #ef4444;
  --c-error-light: #fef2f2;

  --c-header-from: #0f172a;
  --c-header-to: #1e293b;

  --font-main: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;

  --header-h: 64px;
  --input-h: 140px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-input: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

  --grad-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --grad-header: linear-gradient(135deg, var(--c-header-from) 0%, var(--c-header-to) 100%);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* リセット */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-main); background: var(--c-bg); color: var(--c-text); line-height: 1.7; min-height: 100vh; display: flex; flex-direction: column; }

/* ============================================
   ヘッダー
   ============================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--grad-header);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
}
.header-inner { max-width: 100%; margin: 0 auto; padding: 0 24px; height: 100%; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s var(--ease);
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); color: white; }

.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 0 12px rgba(59,130,246,0.4), 0 0 24px rgba(139,92,246,0.2);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(59,130,246,0.4), 0 0 24px rgba(139,92,246,0.2); }
  50% { box-shadow: 0 0 18px rgba(59,130,246,0.6), 0 0 36px rgba(139,92,246,0.3); }
}
.brand-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: #fff; }
.brand-sub { font-size: 0.68rem; color: rgba(255,255,255,0.5); font-weight: 400; letter-spacing: 0.03em; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.user-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
  padding: 5px 14px 5px 5px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0; overflow: hidden;
}
.user-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.btn-logout { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-decoration: none; padding: 4px 10px; border-radius: var(--radius-sm); transition: all 0.15s var(--ease); }
.btn-logout:hover { color: #fca5a5; background: rgba(239,68,68,0.15); }

/* ============================================
   レイアウト
   ============================================ */
.app-layout { display: flex; min-height: calc(100vh - var(--header-h)); margin-top: var(--header-h); }

/* ============================================
   サイドバー
   ============================================ */
.sidebar {
  width: 280px; min-width: 280px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  height: calc(100vh - var(--header-h));
  position: sticky; top: var(--header-h);
  overflow: hidden;
  transition: margin-left 0.25s var(--ease), opacity 0.25s var(--ease);
}
.sidebar-overlay { display: none; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--c-border-light); flex-shrink: 0; }
.sidebar-title { font-size: 0.85rem; font-weight: 600; color: var(--c-text-secondary); display: flex; align-items: center; gap: 6px; }
.sidebar-close { display: none; width: 28px; height: 28px; border: none; background: none; color: var(--c-text-muted); cursor: pointer; border-radius: var(--radius-sm); align-items: center; justify-content: center; transition: all 0.15s var(--ease); }
.sidebar-close:hover { background: var(--c-bg); color: var(--c-text); }
.sidebar-content { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--c-border-light); flex-shrink: 0; }

.history-list { padding: 0 8px; }
.history-loading { padding: 24px 16px; text-align: center; font-size: 0.8rem; color: var(--c-text-muted); }
.history-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; color: var(--c-text-muted); text-align: center; gap: 12px; }
.history-empty p { font-size: 0.8rem; }
.history-group { margin-bottom: 8px; }
.history-group-label { font-size: 0.7rem; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 8px 4px; }
.history-item { display: flex; align-items: center; border-radius: var(--radius-sm); transition: all 0.12s var(--ease); position: relative; }
.history-item:hover { background: var(--c-bg); }
.history-item-main { display: flex; align-items: center; gap: 8px; padding: 8px; flex: 1; min-width: 0; cursor: pointer; border-radius: var(--radius-sm); }
.history-item-icon { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--c-text-muted); background: var(--c-bg); }
.history-item-text { flex: 1; min-width: 0; }
.history-item-query { font-size: 0.8rem; font-weight: 500; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-size: 0.68rem; color: var(--c-text-muted); }
.history-item-delete { width: 28px; height: 28px; border: none; background: none; color: var(--c-text-muted); cursor: pointer; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; opacity: 0; transition: all 0.12s var(--ease); flex-shrink: 0; }
.history-item:hover .history-item-delete { opacity: 1; }
.history-item-delete:hover { color: var(--c-error); background: var(--c-error-light); }
.history-clear-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text-muted); font-family: inherit; font-size: 0.75rem; cursor: pointer; transition: all 0.15s var(--ease); }
.history-clear-btn:hover { border-color: var(--c-error); color: var(--c-error); background: var(--c-error-light); }

/* ============================================
   メイン
   ============================================ */
.main { flex: 1; display: flex; flex-direction: column; max-width: 960px; width: 100%; margin: 0 auto; padding: 0 24px; min-width: 0; }

/* ============================================
   モード選択
   ============================================ */
.mode-selector { display: flex; gap: 10px; padding: 20px 0 8px; }

.mode-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.25s var(--ease);
  font-family: inherit; color: var(--c-text-secondary);
  position: relative; overflow: hidden;
}
.mode-btn::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad-primary);
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.mode-btn svg { margin-bottom: 2px; opacity: 0.5; transition: all 0.25s var(--ease); }
.mode-btn span { font-size: 0.85rem; font-weight: 600; }
.mode-btn small { font-size: 0.68rem; color: var(--c-text-muted); }
.mode-btn:hover { border-color: var(--c-primary); background: var(--c-primary-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.mode-btn:hover::before { opacity: 1; }
.mode-btn:hover svg { opacity: 1; }
.mode-btn.active { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary); box-shadow: var(--shadow-md), var(--shadow-glow); }
.mode-btn.active::before { opacity: 1; }
.mode-btn.active svg { opacity: 1; color: var(--c-primary); }

/* ============================================
   スコープ選択
   ============================================ */
.scope-selector { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.scope-label { font-size: 0.78rem; color: var(--c-text-muted); font-weight: 500; white-space: nowrap; }
.scope-btns { display: flex; gap: 4px; }
.scope-btn { font-family: inherit; font-size: 0.78rem; font-weight: 500; padding: 4px 14px; border: 1px solid var(--c-border); border-radius: var(--radius-full); background: var(--c-surface); color: var(--c-text-secondary); cursor: pointer; transition: all 0.15s var(--ease); }
.scope-btn:hover:not(:disabled) { border-color: var(--c-primary); color: var(--c-primary); }
.scope-btn.active { background: var(--grad-primary); border-color: transparent; color: white; box-shadow: 0 2px 6px rgba(59,130,246,0.25); }
.scope-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================
   チャットエリア
   ============================================ */
.chat-container { flex: 1; overflow-y: auto; padding: 16px 0; min-height: 0; }

.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; animation: fadeIn 0.5s var(--ease); }
.welcome-icon { color: var(--c-primary); opacity: 0.4; margin-bottom: 20px; filter: drop-shadow(0 0 8px rgba(59,130,246,0.3)); animation: welcomePulse 4s ease-in-out infinite; }

@keyframes welcomePulse {
  0%, 100% { opacity: 0.3; filter: drop-shadow(0 0 8px rgba(59,130,246,0.2)); }
  50% { opacity: 0.5; filter: drop-shadow(0 0 16px rgba(139,92,246,0.4)); }
}
.welcome h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; color: var(--c-text); }
.welcome p { font-size: 0.88rem; color: var(--c-text-muted); max-width: 480px; line-height: 1.7; }

.example-queries { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; justify-content: center; }
.example-btn {
  font-family: inherit; font-size: 0.8rem; padding: 8px 18px;
  border: 1px solid var(--c-border); border-radius: var(--radius-full);
  background: var(--c-surface); color: var(--c-text-secondary);
  cursor: pointer; transition: all 0.2s var(--ease); box-shadow: var(--shadow-sm);
}
.example-btn:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* メッセージ */
.messages { display: flex; flex-direction: column; gap: 20px; }
.qa-section { padding: 20px 0 40px; border-bottom: 1px solid var(--c-border-light); position: relative; display: flex; flex-direction: column; gap: 12px; }
.qa-section:last-child { border-bottom: none; }

.followup-badge { display: inline-block; font-size: 0.75rem; color: var(--c-primary); background: var(--c-primary-light); border: 1px solid var(--c-primary-subtle); border-radius: 12px; padding: 3px 12px; margin: 0 0 4px 46px; }
.retry-notice { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--c-text-muted); padding: 8px 0 4px 46px; animation: fadeIn 0.3s var(--ease); }
.retry-notice svg { flex-shrink: 0; color: var(--c-primary); animation: spin 1s linear infinite; }
.retry-notice.retry-failed svg { color: var(--c-text-muted); animation: none; }
.retry-notice.retry-done svg { color: var(--c-success); animation: none; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.message { display: flex; gap: 12px; animation: slideUp 0.3s var(--ease); }
.message-user { flex-direction: row-reverse; }
.message-avatar { width: 34px; height: 34px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.75rem; font-weight: 600; }
.message-user .message-avatar { background: var(--grad-primary); color: white; }
.message-ai .message-avatar { background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%); color: white; }
.message-body { max-width: 85%; min-width: 0; }
.message-user .message-body { text-align: right; }

.message-bubble { display: inline-block; padding: 12px 18px; border-radius: var(--radius-lg); font-size: 0.9rem; line-height: 1.7; text-align: left; }
.message-user .message-bubble { background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%); color: white; border-bottom-right-radius: 4px; box-shadow: 0 2px 8px rgba(59,130,246,0.2); }
.message-ai .message-bubble { background: var(--c-surface); border: 1px solid var(--c-border-light); border-bottom-left-radius: 4px; box-shadow: var(--shadow-md); white-space: pre-wrap; }

.keywords-badge { font-size: 0.75rem; color: #6b7280; margin-bottom: 6px; padding: 2px 8px; background: #f3f4f6; border-radius: 12px; display: inline-block; }
.new-search-btn { display: none; margin: 0 auto 8px; padding: 4px 14px; font-size: 0.78rem; color: var(--c-primary); background: var(--c-primary-light); border: 1px solid var(--c-primary-subtle); border-radius: 16px; cursor: pointer; transition: all 0.2s; }
.new-search-btn:hover { background: var(--c-primary-subtle); }

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { padding-left: 1.2em; margin-bottom: 8px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble strong { font-weight: 600; }
.message-bubble code { font-family: var(--font-mono); font-size: 0.85em; background: var(--c-bg); padding: 1px 5px; border-radius: 3px; }

/* 引用リンク */
.cite-link { display: inline; color: var(--c-primary); font-size: 0.8em; font-weight: 700; text-decoration: none; vertical-align: super; margin: 0 1px; cursor: pointer; transition: color 0.15s var(--ease); }
.cite-link:hover { color: var(--c-accent); text-decoration: underline; }

/* 出典カード */
.citations { margin-top: 12px; }
.citations-title { font-size: 0.73rem; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.citation-num { font-size: 0.75rem; font-weight: 700; color: var(--c-primary); flex-shrink: 0; min-width: 24px; }
.citation-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-md); margin-bottom: 6px; text-decoration: none; color: inherit; transition: all 0.2s var(--ease); }
.citation-card:hover { border-color: var(--c-primary); background: var(--c-primary-light); transform: translateX(2px); }
.citation-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; flex-shrink: 0; }
.citation-icon.docx { background: #dbeafe; color: #1d4ed8; }
.citation-icon.xlsx { background: #dcfce7; color: #16a34a; }
.citation-icon.pptx { background: #fee2e2; color: #dc2626; }
.citation-icon.pdf  { background: #fef3c7; color: #d97706; }
.citation-icon.txt  { background: #f3f4f6; color: #6b7280; }
.citation-info { flex: 1; min-width: 0; }
.citation-name { font-size: 0.82rem; font-weight: 500; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citation-date { font-size: 0.7rem; color: var(--c-text-muted); }
.citation-arrow { color: var(--c-text-muted); flex-shrink: 0; }

/* 検索結果 */
.search-results { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }

/* チェックボックス */
.result-checkbox { display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 10px 0 10px 14px; cursor: pointer; }
.result-checkbox input[type="checkbox"] { display: none; }
.checkbox-mark { width: 18px; height: 18px; border: 2px solid var(--c-border); border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.15s var(--ease); background: var(--c-surface); }
.result-checkbox input:checked + .checkbox-mark { background: var(--grad-primary); border-color: transparent; }
.result-checkbox input:checked + .checkbox-mark::after { content: ""; width: 5px; height: 9px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-bottom: 2px; }
.result-checkbox:hover .checkbox-mark { border-color: var(--c-primary); }
.search-result-item:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-light); }

/* 比較ツールバー */
.compare-toolbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; margin-bottom: 4px; background: var(--c-primary-light); border: 1px solid var(--c-primary-subtle); border-radius: var(--radius-md); animation: fadeIn 0.2s var(--ease); }
.compare-count { font-size: 0.78rem; color: var(--c-text-secondary); flex: 1; }
.compare-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; font-size: 0.78rem; font-weight: 500; font-family: var(--font-main); color: white; background: var(--grad-primary); border: none; border-radius: var(--radius-full); cursor: pointer; transition: all 0.15s var(--ease); white-space: nowrap; box-shadow: 0 2px 6px rgba(59,130,246,0.2); }
.compare-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.compare-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.compare-btn svg { flex-shrink: 0; }

/* 検索結果アイテム */
.search-result-item { display: flex; flex-wrap: wrap; align-items: flex-start; background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-md); transition: all 0.2s var(--ease); overflow: hidden; }
.search-result-item:hover { border-color: var(--c-primary); background: var(--c-primary-light); box-shadow: var(--shadow-sm); }
.result-link { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px 6px 0; text-decoration: none; color: inherit; flex: 1; min-width: 0; }
.result-ext { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; flex-shrink: 0; margin-top: 2px; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 0.7rem; color: var(--c-text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: 2px; }
.meta-item { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.meta-item svg { flex-shrink: 0; opacity: 0.6; }
.meta-sep { color: var(--c-border); margin: 0 2px; font-size: 0.6rem; }

/* 要約エリア */
.result-summary-area { width: 100%; padding: 0 14px 10px 46px; }
.summary-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 0.72rem; color: var(--c-primary); background: var(--c-primary-light); border: 1px solid var(--c-primary-subtle); border-radius: var(--radius-full); cursor: pointer; transition: all 0.15s var(--ease); font-family: var(--font-main); }
.summary-btn:hover { background: var(--c-primary-subtle); border-color: var(--c-primary); }
.summary-btn svg { flex-shrink: 0; }
.result-summary { font-size: 0.75rem; color: var(--c-text-secondary); line-height: 1.5; padding: 6px 8px; background: var(--c-surface); border-radius: var(--radius-sm); border-left: 3px solid; border-image: linear-gradient(180deg, #3b82f6, #8b5cf6) 1; white-space: normal; word-break: break-word; }
.result-summary-loading { font-size: 0.75rem; color: var(--c-text-muted); padding: 4px 0; display: flex; align-items: center; gap: 6px; }
.result-summary-error { font-size: 0.75rem; color: var(--c-text-muted); font-style: italic; padding: 4px 0; }
.summary-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }

/* ローディング */
.loading-dots { display: flex; gap: 6px; padding: 8px 0; }
.loading-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); opacity: 0.4; animation: bounce 1.4s infinite both; }
.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

/* ============================================
   入力エリア
   ============================================ */
.input-area { padding: 12px 0 20px; background: var(--c-bg); position: sticky; bottom: 0; }
.input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--radius-lg); padding: 8px 8px 8px 18px; box-shadow: var(--shadow-input); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.input-wrapper:focus-within { border-color: var(--c-primary); box-shadow: var(--shadow-input), 0 0 0 3px rgba(59,130,246,0.12); }
.input-wrapper textarea { flex: 1; border: none; outline: none; font-family: inherit; font-size: 0.92rem; line-height: 1.6; resize: none; background: transparent; color: var(--c-text); min-height: 24px; max-height: 120px; padding: 4px 0; }
.input-wrapper textarea::placeholder { color: var(--c-text-muted); }
.send-btn { width: 38px; height: 38px; border-radius: var(--radius-md); border: none; background: var(--grad-primary); color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s var(--ease); box-shadow: 0 2px 6px rgba(59,130,246,0.25); }
.send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(59,130,246,0.35); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.input-hint { font-size: 0.72rem; color: var(--c-text-muted); text-align: center; margin-top: 8px; }

/* エラー */
.error-bubble { background: var(--c-error-light) !important; border-color: #fca5a5 !important; color: var(--c-error) !important; }

/* ============================================
   アニメーション
   ============================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* ============================================
   レスポンシブ
   ============================================ */
@media (min-width: 1024px) { .sidebar-toggle { display: none; } .sidebar-close { display: none; } }

@media (max-width: 1023px) {
  .sidebar { position: fixed; top: var(--header-h); left: 0; z-index: 90; transform: translateX(-100%); transition: transform 0.25s var(--ease); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: block; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.4); z-index: 80; opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
}

@media (max-width: 640px) {
  html { font-size: 14px; }
  .header-inner { padding: 0 12px; }
  .brand-sub { display: none; }
  .main { padding-left: 12px; padding-right: 12px; }
  .mode-btn small { display: none; }
  .mode-btn { padding: 10px 6px; }
  .message-body { max-width: 90%; }
  .user-badge span { display: none; }
  .sidebar { width: 260px; min-width: 260px; }
}
