/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e94560;
  --primary-dark: #c73652;
  --secondary: #1a1a2e;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.18);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
  --filter-width: 280px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Header ===== */
.header {
  background: var(--secondary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.logo-mark {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.header-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
  flex-shrink: 0;
}

/* ===== グローバルナビ ===== */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.12); color: white; }
.nav-link--active { background: rgba(255,255,255,.15); color: white; }

/* ===== ユーザードロップダウン ===== */
.user-menu {
  position: relative;
  flex-shrink: 0;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 5px 10px 5px 6px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}
.user-menu-btn:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}
.user-menu-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-arrow { opacity: .7; flex-shrink: 0; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 9999;
  overflow: hidden;
}
.user-dropdown-info {
  padding: 12px 14px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
}
.user-dropdown-display { font-weight: 700; font-size: 0.9rem; color: var(--secondary); }
.user-dropdown-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.user-dropdown-section {
  padding: 8px 14px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.user-dropdown-item {
  display: block;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  transition: background .12s;
}
.user-dropdown-item:hover, .user-dropdown-item.active { background: #f0f4ff; color: var(--primary); }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown-logout { color: #c0392b !important; }
.user-dropdown-logout:hover { background: #fff0f0 !important; }

/* 後方互換: 旧テンプレートの btn-logout */
.header-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: 8px; }
.user-name { font-size: 13px; color: rgba(255,255,255,.8); }
.btn-logout {
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  color: rgba(255,255,255,.85);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.6); color: white; }

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-value {
  color: white;
  font-weight: 600;
}

/* ===== Layout ===== */
.main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* ===== Filter Panel ===== */
.filter-panel {
  width: var(--filter-width);
  flex-shrink: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.filter-panel::-webkit-scrollbar { width: 6px; }
.filter-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.filter-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
}

.btn-reset {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-reset:hover { background: #fee2e2; color: var(--primary); border-color: var(--primary); }

/* ===== AI会話型検索 ===== */
.chat-search-wrap {
  background: linear-gradient(135deg, #f0f4ff 0%, #fdf0ff 100%);
  border: 1px solid #c8d8ff;
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-search-label {
  font-size: 11px;
  font-weight: 700;
  color: #5b4fcf;
  letter-spacing: .03em;
}
.chat-reset-btn {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  transition: var(--transition);
}
.chat-reset-btn:hover { background: #fee2e2; color: var(--primary); border-color: var(--primary); }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-bubble {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 10px;
  max-width: 90%;
  word-break: break-word;
}
.chat-bubble--user {
  background: #5b4fcf;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.chat-bubble--ai {
  background: white;
  color: var(--text);
  align-self: flex-start;
  border: 1px solid #dde4ff;
  border-bottom-left-radius: 3px;
}
.chat-bubble--ai.chat-bubble--search {
  border-color: #b8f0d0;
  background: #f0fff8;
}
.chat-bubble--typing {
  background: white;
  color: var(--text-muted);
  align-self: flex-start;
  border: 1px solid #dde4ff;
  border-bottom-left-radius: 3px;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.chat-input {
  flex: 1;
  border: 1px solid #c8d8ff;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  background: white;
  font-family: inherit;
}
.chat-input:focus { outline: none; border-color: #5b4fcf; box-shadow: 0 0 0 2px rgba(91,79,207,.15); }
.chat-send-btn {
  padding: 6px 12px;
  background: #5b4fcf;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
  align-self: flex-end;
}
.chat-send-btn:hover { background: #4a3db8; }
.chat-send-btn:disabled { background: #aaa; cursor: not-allowed; }

.filter-group {
  margin-bottom: 16px;
}

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.range-inputs .filter-input { flex: 1; min-width: 0; }
.range-sep { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

/* Tag Cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 150px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
}

.tag-cloud-item {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  background: #f3f4f6;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.tag-cloud-item:hover { background: #fee2e2; color: var(--primary); }
.tag-cloud-item.selected { background: var(--primary); color: white; }

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.selected-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 11px;
}

.selected-tag-chip button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
}
.selected-tag-chip button:hover { opacity: 1; }

.btn-search {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-top: 4px;
}
.btn-search:hover { background: var(--primary-dark); }
.btn-search:active { transform: scale(.98); }

/* ===== Results Panel ===== */
.results-panel {
  flex: 1;
  min-width: 0;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.results-info {
  font-size: 13px;
  color: var(--text-muted);
}

.results-info strong { color: var(--text); }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-select {
  width: auto;
  min-width: 140px;
}

.btn-sort-order {
  padding: 7px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}
.btn-sort-order:hover { background: var(--bg); }
.btn-sort-order.asc { transform: rotate(180deg); }

.export-controls { display: flex; gap: 6px; }

.btn-export {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.btn-export:hover { background: var(--secondary); color: white; border-color: var(--secondary); }

/* ===== Project Grid ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Project Card */
.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* セマンティック検索結果 */
.semantic-card { border: 2px solid #a8d8bf; }
.semantic-score {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #2ecc71;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  z-index: 1;
  letter-spacing: .02em;
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #f3f4f6;
}

.card-thumbnail-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-light);
}

.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-owner {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-owner::before { content: "👤"; font-size: 11px; }

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.card-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.card-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-amount-row {
  background: linear-gradient(135deg, #fff5f5, #ffe4e8);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.card-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.card-amount-label {
  font-size: 10px;
  color: var(--primary);
  opacity: 0.7;
  margin-top: 2px;
}

.card-achievement {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  text-align: right;
}

/* Achievement bar */
.achievement-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.achievement-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #f97316);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-tag {
  padding: 2px 6px;
  background: #f3f4f6;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 11px;
}

.card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}

.card-keywords-label {
  font-size: 11px;
  margin-right: 2px;
}

.card-keyword {
  padding: 2px 6px;
  background: #eff6ff;
  color: #3b82f6;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 11px;
}

.card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.card-date { display: flex; align-items: center; gap: 4px; }

.card-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 11px;
}
.card-link:hover { text-decoration: underline; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: var(--transition);
}
.page-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.ellipsis { cursor: default; border: none; background: none; }

/* ===== Loading & Empty States ===== */
.loading-state,
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: #fee2e2; border-color: var(--primary); }

.modal-project-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  padding-right: 32px;
}

.modal-thumbnail {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.modal-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.modal-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.modal-stat-value.highlight { color: var(--primary); }

.modal-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-meta-key { color: var(--text-muted); font-weight: 600; }
.modal-meta-val { color: var(--text); }

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-tag {
  padding: 4px 10px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.modal-keywords-section {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
}

.modal-keywords-title {
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.modal-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-keyword {
  padding: 4px 10px;
  background: #ffffff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  border-radius: 20px;
  font-size: 12px;
}

.modal-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 16px;
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition);
}
.modal-link:hover { background: var(--primary-dark); }

/* ===== AI Analysis Panel ===== */
.analysis-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
  border-bottom: 1px solid var(--border);
}

.analysis-title {
  font-size: 13px;
  font-weight: 700;
  color: #3730a3;
}

.btn-analyze {
  padding: 5px 14px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-analyze:hover:not(:disabled) { background: #4338ca; }
.btn-analyze:disabled { opacity: 0.6; cursor: not-allowed; }

.analysis-body {
  padding: 14px;
  background: #fafbff;
}

.analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
}

.analysis-text {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}

.analysis-text strong {
  color: #3730a3;
  display: block;
  margin-top: 10px;
  margin-bottom: 2px;
}

.analysis-error {
  color: var(--primary);
  font-size: 13px;
  padding: 4px 0;
}

/* ===== Crawl Notice Banner ===== */
.crawl-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Favorites ===== */
.star-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition), transform var(--transition);
  z-index: 2;
}
.star-btn:hover { color: #f59e0b; background: #fff; transform: scale(1.15); }
.star-btn.starred { color: #f59e0b; }

.modal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-title-row .modal-project-title {
  flex: 1;
  margin-bottom: 0;
}
.star-btn-modal {
  position: static;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  font-size: 22px;
  background: var(--bg);
}

.filter-label-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.filter-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .main { flex-direction: column; padding: 12px; }
  .filter-panel { width: 100%; position: static; max-height: none; }
  .modal-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header-stats { display: none; }
}

@media (max-width: 600px) {
  .project-grid { grid-template-columns: 1fr; }
  .modal-stats-grid { grid-template-columns: 1fr 1fr; }
}
