/* AICA - 投研网站样式 (深色 + 极简) */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --border: #30363d;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* 顶部栏 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 24px; }
.brand h1 { font-size: 18px; font-weight: 600; }
.user-area { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 14px; color: var(--text-dim); }
.badge-admin { background: var(--warning); color: #000; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; margin-left: 4px; }

/* 按钮 */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--text-dim); cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-ghost:hover { background: var(--bg-elev); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* 容器 */
.container { max-width: 960px; margin: 0 auto; padding: 32px 16px; }

/* 输入区 */
.input-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.input-section h2 { font-size: 16px; margin-bottom: 4px; }
.input-section .hint { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: "SF Mono", "Consolas", monospace;
}
.input-row input:focus { outline: none; border-color: var(--accent); }

/* 进度条 */
.progress {
  margin-top: 12px;
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.08);
}
.progress.hidden { display: none; }

.progress-text {
  display: block;
  text-align: center;
  line-height: 24px;
  font-size: 12px;
  color: var(--text);
  z-index: 1;
}

/* 消息 */
.message {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.message.hidden { display: none; }
.message.success { background: rgba(63, 185, 80, 0.1); color: var(--success); border: 1px solid var(--success); }
.message.error { background: rgba(248, 81, 73, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.message.info { background: rgba(88, 166, 255, 0.1); color: var(--accent); border: 1px solid var(--accent); }

/* 列表区 */
.list-section h2 { font-size: 16px; margin-bottom: 16px; }
.research-list { display: flex; flex-direction: column; gap: 12px; }
.empty { text-align: center; color: var(--text-dim); padding: 32px; font-size: 14px; }

.research-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.research-item .item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.research-item .item-title { font-size: 15px; font-weight: 600; }
.research-item .item-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.research-item .item-ca { font-family: "SF Mono", "Consolas", monospace; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.research-item .item-ca:hover { color: var(--accent); }
.research-item .item-actions { display: flex; gap: 6px; }
.btn-reresearch {
  background: transparent;
  color: #d2a8ff;
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-reresearch:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
  color: #f3e8ff;
  transform: translateY(-1px);
}
.btn-reresearch:active { transform: translateY(0); }
.socials { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.socials a { font-size: 12px; color: var(--accent); text-decoration: none; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; }
.socials a:hover { background: var(--accent); color: #fff; }
.socials .no-socials { font-size: 12px; color: var(--text-dim); }

.report-toggle {
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}
.report-toggle:hover { text-decoration: underline; }
.report-text {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 600px;
  overflow-y: auto;
}
.report-prose.hidden { display: none; }

/* 弹窗 - 现代深色风 (2025-07-09) */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: aica-modal-fade 0.2s ease-out;
}
.modal.hidden { display: none; }
@keyframes aica-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 14px;
  padding: 32px 28px 24px;
  width: 380px;
  max-width: 90vw;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.1), 0 0 40px rgba(139, 92, 246, 0.15);
  animation: aica-modal-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes aica-modal-pop {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  border-radius: 14px 14px 0 0;
}
.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 50%;
}
.modal-content h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #e6edf3;
  background: linear-gradient(90deg, #79c0ff, #d2a8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 20px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.modal-close:hover {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border-color: #f85149;
  transform: rotate(90deg);
}
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-row input {
  width: 100%;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.15s;
}
.form-row input:focus {
  outline: none;
  border-color: #8b5cf6;
  background: rgba(13, 17, 23, 0.9);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-row input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-actions .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.modal-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.45);
}
.modal-actions .btn-primary:active { transform: translateY(0); }
.modal-actions .btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.modal-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-dim);
}
.modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.modal-switch a {
  color: #79c0ff;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed rgba(121, 192, 255, 0.5);
}
.modal-switch a:hover {
  color: #a5d6ff;
  border-bottom-style: solid;
}

/* ═══ AICA 投研报告美化 v2 (2025-07-09 深色 + 紫蓝 + X 链接) ═══ */

/* ── 进度条 spinner + elapsed ── */
.progress {
  position: relative;
  align-items: center;
  gap: 14px;
}
.progress-content { flex: 1; }
.progress-fill-row {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  width: 0%;
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}
.progress-spinner {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 3px solid rgba(139, 92, 246, 0.15);
  border-top-color: #8b5cf6;
  border-right-color: #3b82f6;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}
.progress.spinning .progress-spinner {
  opacity: 1;
  animation: aica-spin 0.9s linear infinite;
}
@keyframes aica-spin {
  to { transform: rotate(360deg); }
}

/* ── 金融投研报告 (深色主题 + 紫蓝) ── */
.report-prose {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: #c9d1d9;
  padding: 24px 28px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.6) 0%, rgba(13, 17, 23, 0.85) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-left: 4px solid #8b5cf6;
  border-radius: 8px;
  margin-top: 8px;
  max-width: 100%;
  overflow-x: auto;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.08);
}

/* 标题层级 (深色 + 蓝紫渐变) */
.report-prose h1, .report-prose h2, .report-prose h3, .report-prose h4 {
  font-family: Georgia, 'Times New Roman', '宋体', serif;
  font-weight: 700;
  margin: 24px 0 12px;
  line-height: 1.4;
  color: #e6edf3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.report-prose h1 {
  font-size: 24px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #3b82f6, #8b5cf6, transparent) 1;
  padding-bottom: 10px;
  margin-top: 0;
  background: linear-gradient(90deg, #79c0ff, #d2a8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.report-prose h2 {
  font-size: 20px;
  color: #79c0ff;
  border-left: 4px solid #3b82f6;
  padding-left: 12px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), transparent);
  padding-top: 6px;
  padding-bottom: 6px;
}
.report-prose h3 {
  font-size: 17px;
  color: #d2a8ff;
  border-bottom: 1px dashed rgba(210, 168, 255, 0.3);
  padding-bottom: 4px;
}
.report-prose h4 {
  font-size: 15px;
  color: #c4b5fd;
}

/* 段落 + 重点 */
.report-prose p {
  margin: 10px 0;
  text-align: justify;
  color: #c9d1d9;
}
.report-prose strong {
  color: #f0b86e;
  font-weight: 700;
  background: linear-gradient(180deg, transparent 60%, rgba(240, 184, 110, 0.18) 60%);
  padding: 0 2px;
}
.report-prose em { color: #79c0ff; font-style: italic; }

/* 列表 */
.report-prose ol, .report-prose ul {
  margin: 10px 0 10px 24px;
  padding-left: 8px;
}
.report-prose li {
  margin: 6px 0;
  line-height: 1.7;
  color: #c9d1d9;
}
.report-prose ol > li::marker { color: #79c0ff; font-weight: 700; }
.report-prose ul > li::marker { color: #d2a8ff; }

/* 引用块 (利空/风险总结) - 紫红边 */
.report-prose blockquote {
  border-left: 4px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  padding: 10px 16px;
  margin: 14px 0;
  color: #e6edf3;
  font-style: italic;
  border-radius: 0 6px 6px 0;
}
.report-prose blockquote strong { color: #f0b86e; }

/* 表格 - 深色 */
.report-prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 13px;
  background: rgba(22, 27, 34, 0.4);
}
.report-prose th, .report-prose td {
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 8px 12px;
  text-align: left;
  color: #c9d1d9;
}
.report-prose th {
  background: linear-gradient(180deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-weight: 700;
}
.report-prose tr:nth-child(even) { background: rgba(139, 92, 246, 0.05); }

/* 行内代码 + 代码块 */
.report-prose code {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12.5px;
  color: #d2a8ff;
}
.report-prose pre {
  background: #010409;
  color: #e6edf3;
  padding: 12px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.report-prose pre code { background: none; border: none; color: inherit; padding: 0; }

/* 链接 (普通引用 [1][2]) */
.report-prose a {
  color: #79c0ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(121, 192, 255, 0.5);
  transition: all 0.15s;
}
.report-prose a:hover {
  color: #a5d6ff;
  border-bottom-style: solid;
  border-bottom-color: #a5d6ff;
  background: rgba(121, 192, 255, 0.1);
}

/* X 账户 @mention 特殊样式 - 紫胶囊 */
.report-prose .x-mention {
  display: inline-block;
  color: #d2a8ff;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  padding: 0 6px;
  margin: 0 1px;
  font-size: 13px;
  border-bottom: none;
  text-decoration: none;
  transition: all 0.15s;
}
.report-prose .x-mention:hover {
  background: rgba(139, 92, 246, 0.35);
  color: #f3e8ff;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* 分隔线 */
.report-prose hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
  margin: 20px 0;
}

/* 切换按钮稍美化 */
.report-toggle {
  margin-top: 8px;
  cursor: pointer;
  color: #79c0ff;
  font-size: 13px;
  user-select: none;
  padding: 4px 0;
}
.report-toggle:hover { color: #a5d6ff; text-decoration: underline; }

/* ═══ 密码框 + 确认弹窗 (2025-07-09 v5) ═══ */

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap input {
  padding-right: 42px !important;  /* 给眼睛按钮留位置 */
}
.toggle-password {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  color: var(--text-dim);
}
.toggle-password:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #d2a8ff;
}
.toggle-password:active { transform: translateY(-50%) scale(0.9); }

/* 确认弹窗 - 略小 */
.modal-content-confirm {
  width: 360px;
  padding: 28px 24px 20px;
}
.modal-content-confirm .modal-icon {
  width: 52px;
  height: 52px;
  font-size: 26px;
  margin-bottom: 12px;
}
.modal-content-confirm h3 {
  font-size: 17px;
  margin-bottom: 8px;
}
.modal-content-confirm .modal-subtitle {
  font-size: 13px;
  white-space: pre-line;  /* 支持 \n 换行 */
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ═══ 进度条升级 v6 (2025-07-09 预计提示 + mm:ss 大字号) ═══ */
.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}
.progress-elapsed {
  font-size: 15px;
  font-weight: 700;
  color: #79c0ff;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  letter-spacing: 0.5px;
  background: rgba(121, 192, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.progress-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.5;
}
.progress-hint strong {
  color: #d2a8ff;
  background: linear-gradient(180deg, transparent 60%, rgba(139, 92, 246, 0.2) 60%);
  padding: 0 4px;
  font-weight: 700;
}
