/* invest-sys 全局样式
 * 依据：《投资系统_开发实施全书》v3.7 第 21 章
 *        docs/PreviewAdjustment_v3_Architecture.md 第 7.2 节
 * 手写 CSS，禁止引入 Bootstrap/MUI 等样式框架
 *
 * KC-20260828-001 A5（主人口令 2026-08-29，Linear 参考）：
 *   ① 80% 黑白灰，一页彩色不超过 3 处（状态语义色除外）；
 *   ② 间距为 8 的倍数（0/4 微调/8/16/24/32/40）；
 *   ③ 审批按钮永远停在人工最后一步。
 *   主色修订登记：深靛蓝 #2563EB 作废，强调蓝 #2563EB 仅主按钮与链接。
 */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --card-bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --primary: #2563EB;
  --primary-light: #EFF6FF;
  --danger: #DC2626;
  --warning: #f59e0b;
  --success: #16a34a;
  --border: #e5e7eb;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 24px rgba(17, 17, 17, 0.06);
  --sidebar-width: 224px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 顶部品牌栏 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  position: relative;
}

.brand-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-logo .radar-sweep {
  transform-origin: 50% 50%;
  animation: radar-sweep 2.5s linear infinite;
}

@keyframes radar-sweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
}

.topbar-actions a {
  color: var(--text);
}

.topbar-actions a:hover {
  color: var(--primary);
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
}

/* 旧顶部导航保留兜底（避免未改造页面异常），但 base.html 中已移除主导航 */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
}

.nav-links a {
  margin-left: 16px;
  font-size: 0.95rem;
}

/* 全局布局：左侧边栏 + 主内容区 */
.layout {
  display: flex;
  min-height: calc(100vh - 59px);
}

/* 左侧固定导航栏 */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 59px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.25s ease;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-group {
  margin-bottom: 4px;
}

/* v3.2：单层直达链接，整组 li 可点击 */
.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius);
  margin: 0 8px;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.nav-group-title:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.nav-group.active > .nav-group-title {
  background: var(--primary-light);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.nav-group-title-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

/* 旧展开箭头已废弃；手风琴导航启用后由 .nav-group-expandable 控制显示 */
.nav-group-arrow,
.nav-submenu {
  display: none;
}

.nav-group-expandable .nav-group-arrow,
.nav-group-expandable .nav-submenu {
  display: block;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 0;
  padding: 16px;
  background: var(--bg);
  min-height: calc(100vh - 59px);
}

body.has-sidebar .main-content {
  margin-left: var(--sidebar-width);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* 卡片：白色大圆角 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2, .card h3 {
  margin-top: 0;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #3730a3;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.flash {
  padding: 8px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.flash-info {
  background: #EFF6FF;
  color: #2563EB;
}

.flash-danger {
  background: #fee2e2;
  color: #991b1b;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.banner {
  padding: 8px 16px;
  text-align: center;
  font-weight: 600;
}

.banner-danger {
  background: var(--danger);
  color: #fff;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

th, td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: #f7f7f7;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-gray {
  background: #f7f7f7;
  color: #666666;
}

.badge-blue {
  background: #EFF6FF;
  color: #2563EB;
}

.status-light {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-on {
  background: var(--success);
}

.status-off {
  background: var(--muted);
}

.status-warn {
  background: var(--warning);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.money {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.text-muted {
  color: var(--muted);
}

.text-small {
  font-size: 0.85rem;
}

.text-green {
  color: var(--success);
}

.text-red {
  color: var(--danger);
}

.heaven-light {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.light-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
}

.light-green {
  background: var(--success);
}

.light-yellow {
  background: var(--warning);
}

.light-red {
  background: var(--danger);
}

.light-black {
  background: #111827;
}

.allocation-grid {
  display: grid;
  gap: 16px;
  margin: 8px 0;
}

.allocation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.allocation-label {
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
}

.progress-long {
  background: var(--success);
}

.progress-mid {
  background: var(--primary);
}

.progress-tact {
  background: var(--warning);
}

.push-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.push-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.push-list li:last-child {
  border-bottom: none;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.form-inline .form-group {
  flex: 1 1 140px;
  min-width: 120px;
  margin-bottom: 0;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.85rem;
}

/* 右下角悬浮 AI 按钮：深靛蓝低饱和文字按钮，与全站卡片圆角一致 */
.floating-ai-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 56px;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-lg);
  background: #312e81;
  color: rgba(255, 255, 255, 0.92);
  border: none;
  box-shadow: var(--shadow-card);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.floating-ai-btn:hover {
  background: #2563EB;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(49, 46, 129, 0.25);
}

.floating-ai-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 300px;
  max-height: 420px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  z-index: 80;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.floating-ai-panel.open {
  display: flex;
}

.floating-ai-panel-header {
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--primary);
}

.floating-ai-panel-body {
  padding: 8px 16px;
  overflow-y: auto;
  flex: 1;
}

.floating-ai-panel-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}

.floating-ai-input {
  width: 100%;
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  resize: none;
  min-height: 38px;
  max-height: 120px;
}

/* AI 对话页 Kimi 式布局 */
.chat-layout {
  display: flex;
  height: calc(100vh - 120px);
  min-height: 500px;
  gap: 16px;
}

.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-header h3 {
  margin: 0;
  font-size: 1rem;
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.chat-list li {
  padding: 8px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s ease;
}

.chat-list li:hover {
  background: var(--primary-light);
}

.chat-list li.active {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.chat-list li.empty {
  color: var(--muted);
  cursor: default;
}

.chat-topic {
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0px;
}

.chat-main {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-main-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.chat-main-actions {
  display: flex;
  align-items: center;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  text-align: center;
  margin: auto;
  max-width: 520px;
}

.chat-welcome h2 {
  color: var(--primary);
  margin-bottom: 8px;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.suggestion-chip {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.suggestion-chip:hover {
  background: #EFF6FF;
}

.message {
  max-width: 80%;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  line-height: 1.6;
}

.message.user {
  align-self: flex-end;
  background: var(--primary-light);
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--card-bg);
  border-bottom-left-radius: 4px;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content pre {
  background: #f7f7f7;
  padding: 8px;
  border-radius: var(--radius);
  overflow-x: auto;
}

.message-content code {
  background: #f7f7f7;
  padding: 0px 4px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.message-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.message-source-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.proposal-card {
  margin: 0 16px 16px;
  padding: 16px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
}

.proposal-card h4 {
  margin: 0 0 8px;
  color: var(--primary);
}

.proposal-summary {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.proposal-risk {
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 8px;
}

.proposal-actions {
  display: flex;
  gap: 8px;
}

.chat-input-area {
  padding: 16px 16px;
  border-top: 1px solid var(--border);
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* 悬浮 AI 面板增强 */
.floating-ai-recent {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.floating-ai-recent li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.floating-ai-recent li:last-child {
  border-bottom: none;
}

.floating-ai-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.floating-ai-shortcut {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.floating-ai-shortcut:hover {
  background: #EFF6FF;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .chat-layout {
    flex-direction: column;
    height: auto;
  }

  .chat-sidebar {
    width: 100%;
    max-height: 200px;
  }

  .chat-main {
    min-height: 400px;
  }

  .message {
    max-width: 92%;
  }

  .topbar-hamburger {
    display: inline-block;
  }

  .sidebar {
    transform: translateX(-100%);
    top: 59px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .floating-ai-panel {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .brand-subtitle {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * 页内 Tab 栏（v3.2）
 * --------------------------------------------------------------------------- */
.section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-tab {
  display: inline-block;
  padding: 8px 16px;
  background: var(--card-bg);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease;
}

.section-tab:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.section-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * 股票池六区（T03）
 * --------------------------------------------------------------------------- */
.pool-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.pool-header h2 {
  margin: 0;
}

.pool-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pool-tab {
  display: inline-block;
  padding: 8px 16px;
  background: var(--card-bg);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease;
}

.pool-tab:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.pool-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-pool {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-pool:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card-pool-header h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card-pool-header h3 a {
  color: var(--text);
}

.card-pool-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.card-pool-body {
  margin-bottom: 16px;
}

.card-pool-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.card-pool-row:last-child {
  border-bottom: none;
}

.card-pool-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-pool-actions .btn {
  font-size: 0.85rem;
  padding: 4px 8px;
}

/* 建仓/状态/315 弹窗 */
.pool-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
}

.pool-modal.open {
  display: flex;
}

.pool-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.pool-modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  margin: 16px;
}

.pool-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
}

.pool-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.pool-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.pool-modal-body {
  padding: 16px;
}

.pool-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 16px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  background: #f7f7f7;
  color: var(--text);
}

.btn-cancel:hover {
  background: #e5e7eb;
}

.btn-secondary {
  background: #f7f7f7;
  color: #666666;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

/* 卡片详情页 */
.card-detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

.card-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.card-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.detail-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list li:last-child {
  border-bottom: none;
}

/* 315 体检报告页 */
.inspect-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.inspect-report-header h3 {
  margin: 0;
}

.inspect-card h4 {
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--primary);
}

.inspect-metric {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.inspect-metric:last-child {
  border-bottom: none;
}

/* ---------------------------------------------------------------------------
 * 资金看板双池模型（T04）
 * --------------------------------------------------------------------------- */
.funds-overview {
  margin-bottom: 16px;
}

.funds-card {
  text-align: center;
  padding: 24px 16px;
}

.funds-card-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2563EB 100%);
  color: #fff;
}

.funds-card-primary .funds-label,
.funds-card-primary .funds-sub {
  color: rgba(255, 255, 255, 0.85);
}

.funds-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.funds-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.funds-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.funds-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.funds-section-header h3 {
  margin: 0;
}

.warehouse-summary {
  margin-top: 16px;
}

.warehouse-card {
  padding: 16px;
}

.warehouse-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.warehouse-ratio {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.warehouse-metric {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.warehouse-metric:last-of-type {
  border-bottom: none;
}

.warehouse-progress {
  margin-top: 8px;
}

.warehouse-adjust {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.warehouse-adjust-input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.warehouse-total-line {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--muted);
}

.warehouse-total-line strong {
  color: var(--text);
}

/* KC-20260828-001 A2：卡详情页顶部返回条 + 面包屑 */
.card-detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-sep {
  margin: 0 8px;
  color: var(--border);
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

.warehouse-progress .progress-track {
  margin-bottom: 4px;
}

/* 后台改密表单（T04） */
#change-password-card {
  max-width: 480px;
}

#change-password-msg {
  min-height: 1.2em;
}

/* ---------------------------------------------------------------------------
 * 策略/回测表单与 AI 审查官（T05）
 * --------------------------------------------------------------------------- */
.strategy-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .strategy-layout {
    grid-template-columns: 1fr 320px;
  }
}

.strategy-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.strategy-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-bg);
}

.strategy-section-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.strategy-section-toggle {
  transition: transform 0.2s ease;
}

.strategy-section.open .strategy-section-toggle {
  transform: rotate(180deg);
}

.strategy-section-body {
  display: none;
  padding: 16px;
}

.strategy-section.open .strategy-section-body {
  display: block;
}

.strategy-section-body textarea {
  width: 100%;
  min-height: 120px;
}

.strategy-ai-panel {
  position: sticky;
  top: 80px;
  align-self: flex-start;
}

.strategy-suggestions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-suggestion-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--bg);
}

.strategy-suggestion-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

/* 回测 */
.backtest-form .form-inline {
  gap: 16px;
}

/* AI 审查官 */
.audit-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
}

.audit-drawer.open {
  display: flex;
}

.audit-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.audit-drawer-content {
  position: relative;
  background: var(--card-bg);
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.audit-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.audit-drawer-header h3 {
  margin: 0;
}

.audit-drawer-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--muted);
  cursor: pointer;
}

.audit-create-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.audit-session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.audit-session-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.audit-session-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.audit-session-type {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.audit-session-meta {
  margin-bottom: 8px;
}

.audit-finding-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 8px;
  background: var(--card-bg);
}

.audit-finding-card.finding-high {
  border-left: 4px solid var(--danger);
}

.audit-finding-card.finding-mid {
  border-left: 4px solid var(--warning);
}

.audit-finding-card.finding-low {
  border-left: 4px solid var(--primary);
}

.audit-finding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.audit-finding-target {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--muted);
}

.audit-finding-body {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

.audit-finding-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.audit-finding-actions textarea {
  flex: 1 1 200px;
  min-height: 60px;
}

.text-muted-card {
  background: var(--bg);
}

.warehouse-section-title {
  color: var(--primary);
  margin-top: 16px;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
 * AI 对话输入区升级（T02 v3.2）
 * --------------------------------------------------------------------------- */
.chat-form {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
}

.chat-upload-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-upload-btn:hover {
  background: var(--primary-light);
}

.chat-textarea {
  flex: 1;
  resize: none;
  padding: 8px 8px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
  min-height: calc(1.5em * 3 + 20px);
  max-height: calc(1.5em * 6 + 20px);
  overflow-y: hidden;
}

.chat-textarea:focus {
  outline: none;
}

.chat-send-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
}

.upload-menu {
  position: absolute;
  left: 4px;
  bottom: calc(100% + 8px);
  min-width: 120px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  z-index: 50;
  overflow: hidden;
}

.upload-menu-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.upload-menu-item:hover {
  background: var(--primary-light);
}

/* AI 作战室输入区复用 */
#ai-ask-form.chat-form {
  margin-top: 8px;
}

/* 悬浮 AI 面板输入区 */
.floating-ai-chat-form {
  margin-top: 8px;
}

.floating-ai-chat-form .chat-textarea {
  min-height: calc(1.5em * 3 + 18px);
  max-height: calc(1.5em * 6 + 18px);
  padding: 8px 8px;
  font-size: 0.95rem;
}

.floating-ai-chat-form .chat-upload-btn {
  width: 34px;
  height: 34px;
  font-size: 1.35rem;
}

.floating-ai-chat-form .chat-send-btn {
  height: 34px;
  padding: 0 8px;
  font-size: 0.9rem;
}

/* 兼容旧输入区样式兜底 */
.chat-form textarea,
.chat-form input[type="text"] {
  flex: 1;
}

/* ---------------------------------------------------------------------------
 * v3.4 预览调整单新增样式
 * --------------------------------------------------------------------------- */

/* 2 列卡片网格 */
.card-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .card-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* 可点击卡片 */
.card-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-clickable .btn,
.card-clickable a.btn {
  cursor: pointer;
}

/* 通用弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  margin: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 16px;
  border-top: 1px solid var(--border);
}

/* 后台配置分块卡片 */
.admin-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.admin-config-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.admin-config-card h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--primary);
}

.admin-config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.admin-config-item:last-child {
  border-bottom: none;
}

.admin-config-label {
  color: var(--muted);
}

.admin-config-value {
  font-weight: 600;
  text-align: right;
}

.admin-config-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0px;
  text-align: right;
}

/* 后台卡片管理表格 */
.admin-card-table th,
.admin-card-table td {
  min-width: 80px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-card-table td:hover {
  white-space: normal;
  overflow: visible;
}

/* 模型配置卡 */
.ai-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ai-model-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  border: 1px solid var(--border);
}

.ai-model-card.disabled {
  opacity: 0.7;
  background: #f7f7f7;
}

.ai-model-card h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.ai-model-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ai-model-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.ai-model-row:last-child {
  border-bottom: none;
}

.ai-model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ai-model-header h4 {
  margin: 0;
  font-size: 1.05rem;
}

.ai-model-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.4;
}

.ai-model-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ai-model-actions .btn {
  font-size: 0.8rem;
  padding: 4px 8px;
}

.btn-capability-on {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.btn-capability-on:hover {
  background: #059669;
  border-color: #059669;
}

.btn-disabled,
.btn-disabled:hover,
.btn-disabled:focus,
.btn[disabled],
.btn[disabled]:hover,
.btn[disabled]:focus {
  background: #e5e7eb;
  color: #999999;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

/* 会话列表就地编辑 */
.chat-topic-edit {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-topic-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0px 4px;
}

.btn-icon:hover {
  color: var(--primary);
}

/* 试验股票列表 */
.pilot-stock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.pilot-stock-item {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius);
}

.pilot-stock-item input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 试验详情三栏 */
.pilot-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .pilot-detail-grid {
    grid-template-columns: 1fr;
  }
}

.pilot-pnl-chart {
  width: 100%;
  height: 320px;
}

/* 弹窗内新建体检表单 */
.inspect-create-form .form-group {
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------------------
 * 仪表盘三仓饼图（T03 v3.2）
 * --------------------------------------------------------------------------- */
.pie-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 8px 0;
}

@media (min-width: 768px) {
  .pie-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.pie-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pie-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--text);
}

.pie-warning {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px 0 8px;
}

.pie-stats {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.pie-stats div {
  display: flex;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .pie-stats {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
 * Vision 持仓识别提案卡
 * --------------------------------------------------------------------------- */
.modal-wide {
  max-width: 900px;
}

.vision-proposals {
  margin: 0 16px 16px;
}

.vision-proposal-card {
  border-left-color: var(--danger);
}

.vision-proposal-warning {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.vision-proposal-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.vision-proposal-fields .form-group {
  margin: 0;
}

.vision-proposal-fields label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: var(--muted);
}

.vision-proposal-fields input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .vision-proposal-fields {
    grid-template-columns: 1fr;
  }
}

.proposal-table-wrapper {
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.proposal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.proposal-table th,
.proposal-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.proposal-table th {
  background: var(--bg);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.proposal-table td input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.proposal-table tr.low-confidence {
  background: #fffbeb;
}

.proposal-table tr.low-confidence td input,
.proposal-table tr.low-confidence td select {
  background: #fffbeb;
  border-color: var(--warning);
}

.proposal-table td select.symbol-candidate-select {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.low-confidence-badge {
  display: inline-block;
  padding: 0px 8px;
  background: var(--warning);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------------------
 * 侧边栏手风琴导航（导航重组 v3.x）
 * --------------------------------------------------------------------------- */

button.nav-group-title {
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
}

/* AI 助手图标占位：默认显示 emoji，设置 img src 后自动切换为图片 */
.nav-icon-ai {
  position: relative;
}

.nav-icon-ai .nav-icon-img {
  display: none;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.nav-icon-ai .nav-icon-img:not([src=""]) {
  display: block;
}

.nav-icon-ai .nav-icon-img:not([src=""]) + .nav-icon-emoji {
  display: none;
}

/* 可展开分组的箭头 */
.nav-group-arrow {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-group.open .nav-group-arrow {
  transform: rotate(180deg);
}

/* 子菜单 */
.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.nav-group.open > .nav-submenu {
  max-height: 500px;
}

.nav-submenu-item a {
  display: block;
  padding: 8px 16px 8px 48px;
  margin: 0px 8px;
  font-size: 0.9rem;
  color: var(--text);
  border-radius: var(--radius);
  text-decoration: none;
}

.nav-submenu-item a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.nav-submenu-item.active a {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* 当前激活分组 */
.nav-group.active > .nav-group-title {
  background: var(--primary-light);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * 策略编辑页三段式重构（strategy_edit_rebuild）
 * --------------------------------------------------------------------------- */
.strategy-edit-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 1100px) {
  .strategy-edit-layout {
    grid-template-columns: 1fr 320px;
  }
}

.strategy-edit-main {
  min-width: 0;
}

.strategy-edit-sidebar {
  position: sticky;
  top: 80px;
  align-self: flex-start;
  min-width: 0;
}

.strategy-edit-sidebar .strategy-ai-panel {
  position: static;
  width: 100%;
}

.strategy-compare-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}

.strategy-compare-header-col h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.strategy-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.strategy-compare-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.strategy-compare-card.is-modified {
  border: 2px solid var(--warning);
}

.strategy-compare-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.strategy-compare-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.strategy-compare-card-badge {
  display: none;
  padding: 0px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--warning);
  color: #fff;
}

.strategy-compare-card.is-modified .strategy-compare-card-badge {
  display: inline-block;
}

.strategy-compare-card-body {
  padding: 8px 16px;
  flex: 1;
  max-height: 280px;
  overflow-y: auto;
}

.strategy-compare-card-body textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
}

.strategy-compare-original {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.strategy-compare-original pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  background: transparent;
  padding: 0;
}

.strategy-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.strategy-edit-actions .btn,
.strategy-edit-actions input[type="text"] {
  margin: 0;
}

.strategy-tree-section {
  width: 100%;
  margin-bottom: 16px;
}

.strategy-tree-section ol,
.strategy-tree-section ul {
  padding-left: 16px;
}

.strategy-tree-section li {
  margin-bottom: 4px;
}

@media (max-width: 900px) {
  .strategy-compare-header {
    grid-template-columns: 1fr;
  }

  .strategy-compare-grid {
    grid-template-columns: 1fr;
  }

  .strategy-edit-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .strategy-edit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .strategy-edit-actions .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------------------------------------------------------------------
 * 策略审核页重构（strategy_review_rebuild）
 * --------------------------------------------------------------------------- */
.strategy-review-header .allocation-header {
  align-items: flex-start;
  gap: 16px;
}

.strategy-review-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.strategy-review-layout {
  margin-bottom: 16px;
}

.strategy-review-layout .strategy-compare-grid {
  align-items: start;
}

.strategy-review-result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.strategy-review-result-body {
  padding: 8px 16px;
  flex: 1;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.6;
}

.review-status-pass {
  color: var(--success);
  font-weight: 500;
}

.review-status-fail {
  color: #92400e;
}

.review-status-fail p {
  margin: 0 0 8px;
}

.review-status-fail p:last-child {
  margin-bottom: 0;
}

.review-status-fail strong {
  color: var(--danger);
}

/* KC-20260903-004 疑似误报降级展示（机器复核拦截） */
.review-fp-intercepted {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  opacity: 0.75;
}

.review-fp-intercepted p {
  margin: 0 0 6px;
  font-weight: 400;
}

.review-fp-intercepted strong {
  color: var(--text-muted, #6b7280);
}

.strategy-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.strategy-review-actions .btn,
.strategy-review-actions input[type="text"] {
  margin: 0;
}

.review-issue-summary {
  font-size: 0.9rem;
  color: var(--warning);
  font-weight: 500;
}

@media (max-width: 900px) {
  .strategy-review-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .strategy-review-actions .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------------------------------------------------------------------
 * 策略库列表页五区表格列对齐
 * --------------------------------------------------------------------------- */
.strategy-table {
  table-layout: fixed;
  width: 100%;
}

.strategy-table col.col-id {
  width: 60px;
}

.strategy-table col.col-name {
  width: auto;
}

.strategy-table th,
.strategy-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-table td:last-child,
.strategy-table th:last-child {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.strategy-table .sortable {
  cursor: pointer;
  user-select: none;
}

.strategy-table .sortable:hover {
  background: #EFF6FF;
}

.strategy-table .sortable::after {
  content: ' ↕';
  color: var(--muted);
  font-size: 0.8em;
}

.strategy-table .sortable.sort-asc::after {
  content: ' ↑';
  color: var(--primary);
}

.strategy-table .sortable.sort-desc::after {
  content: ' ↓';
  color: var(--primary);
}

/* KC-20260905-001 任务②：名称列不截断——允许换行显示全名（悬停 title 亦全名） */
.strategy-table td:nth-child(2) .strategy-name-link {
  display: inline;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .strategy-table th,
  .strategy-table td {
    padding: 8px 4px;
    font-size: 0.85rem;
  }
}

/* ---------------------------------------------------------------------------
 * 工单④ D/E 增量：审核页轮询与 toast（strategy_review_ticket4_de）
 * --------------------------------------------------------------------------- */

/* 审查中动态提示 */
.review-running {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin: 8px 0;
  background: #eff6ff;
  border: 1px solid #EFF6FF;
  border-radius: var(--radius);
  color: #2563EB;
  font-weight: 500;
}

.review-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #EFF6FF;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: review-spin 0.8s linear infinite;
}

@keyframes review-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast 容器与消息 */
.review-toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.review-toast {
  padding: 8px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  font-size: 0.95rem;
  font-weight: 500;
  animation: review-toast-in 0.2s ease;
}

.review-toast-success {
  background: #dcfce7;
  color: #166534;
}

.review-toast-danger {
  background: #fee2e2;
  color: #991b1b;
}

@keyframes review-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .review-toast-container {
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ---------------------------------------------------------------------------
 * 六区重构新增样式（T03/T04）
 * --------------------------------------------------------------------------- */

/* 达标卡绿色描边 */
.card-eligible {
  border: 2px solid var(--success);
}

.card-zone-fields {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.card-zone-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.card-zone-row:last-child {
  border-bottom: none;
}

.card-zone-label {
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 8px;
}

.card-zone-value {
  text-align: right;
  word-break: break-all;
}

.tranche-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  padding: 0px 8px;
  font-size: 0.8rem;
  margin-left: 4px;
}

/* 成交识别低置信标黄 */
.low-confidence-field {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
}

.low-confidence-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 0px 8px;
  font-size: 0.75rem;
}

/* 成交识别结果区 */
#trade-vision-result .form-group {
  margin-bottom: 8px;
}

/* 弹窗宽版 */
.modal-wide {
  max-width: 720px;
}

/* 按钮默认样式补齐 */
.btn-default {
  background: #f7f7f7;
  color: var(--text);
}

.btn-info {
  background: #EFF6FF;
  color: #2563EB;
}

/* ---------------------------------------------------------------------------
 * 股票池两级导航与整版美学重塑（2026-08-22 主人参考图方向：干净白底）
 * 一级三仓 = iOS 分段控件；二级八区 = 下划线页签；卡片/表格 = 大圆角 + 柔影
 * --------------------------------------------------------------------------- */

/* 一级三仓：分段控件（灰轨白钮，与二级下划线形成两套视觉语言） */
.pool-nav {
  margin-bottom: 16px;
}

.pool-nav-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.wh-tabs {
  display: inline-flex;
  gap: 0px;
  background: #f7f7f7;
  border-radius: 999px;
  padding: 4px;
}

.wh-tab {
  flex: 1 1 0;
  min-width: 104px;
  text-align: center;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.wh-tab:hover {
  color: var(--text);
  text-decoration: none;
}

.wh-tab.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
}

/* 三仓统计组：无边白卡 + 大数字 */
.wh-stats {
  display: flex;
  gap: 8px;
}

.wh-stat {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 92px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.35;
  transition: box-shadow 0.15s ease;
}

.wh-stat.active {
  box-shadow: 0 0 0 1.5px var(--primary), var(--shadow);
}

.wh-stat-name {
  color: var(--muted);
  font-size: 0.72rem;
}

.wh-stat-amount {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.wh-stat-count {
  color: var(--muted);
  font-size: 0.72rem;
}

.pool-head-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
}

.pool-toolbar-actions {
  display: flex;
  gap: 8px;
}

.pool-toolbar-actions .btn {
  border-radius: 999px;
}

/* 二级八区：下划线文本页签 */
.zone-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.zone-tab {
  flex: 1 1 0;
  min-width: 84px;
  text-align: center;
  padding: 8px 0px 8px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.88rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.zone-tab:hover {
  color: var(--text);
  text-decoration: none;
}

.zone-tab.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* 紧凑卡片：大圆角、柔影、悬浮轻起 */
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1100px) {
  .card-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .card-grid-3 {
    grid-template-columns: 1fr;
  }
  .wh-tabs {
    display: flex;
    width: 100%;
  }
  .wh-tab {
    min-width: 0;
    padding: 8px 4px;
  }
  .pool-head-right {
    margin-left: 0;
  }
}

.card-compact {
  padding: 16px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card-compact:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.card-compact .card-pool-header {
  margin-bottom: 4px;
}

.card-compact .card-pool-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.card-compact .card-zone-row {
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px solid #f7f7f7;
}

.card-compact .card-zone-row:last-child {
  border-bottom: none;
}

.card-compact .card-zone-value .money,
.card-compact .money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* 表格化分区（货架/仓库/原产地） */
.pool-table-wrap {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.pool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pool-table th {
  text-align: left;
  padding: 8px 16px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.pool-table td {
  padding: 8px 16px;
  border-bottom: 1px solid #f7f7f7;
  vertical-align: middle;
}

.pool-table tr:last-child td {
  border-bottom: none;
}

.pool-table tbody tr {
  transition: background 0.12s ease;
}

/* KC-20260829-001：股息池表尾统计行（股息合计/总计） */
.pool-table-total td {
  font-weight: 600;
  border-top: 2px solid var(--border);
  background: var(--bg-soft);
}

/* KC-20260829-003：子弹看板三段可折叠 + rc 余额块 */
.pool-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 8px 16px;
}

.pool-section summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pool-section .pool-table-wrap {
  margin-top: 8px;
}

.rc-balance-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  gap: 16px;
  text-align: center;
  padding: 16px;
}

/* KC-20260829-006：四指标卡一行 + 折线图画布 */
.funds-overview-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .funds-overview-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.capital-line-canvas {
  height: 320px;
  margin-top: 8px;
}

/* KC-20260829-006 R9：资金投入与提取段各列等分 */
.pool-table-equal {
  table-layout: fixed;
}

.pool-table tbody tr:hover td {
  background: #f7f7f7;
}

.pool-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pool-table-name {
  color: var(--text);
  font-weight: 600;
}

.pool-table-actions {
  white-space: nowrap;
}

.pool-table-actions .btn {
  margin-right: 4px;
  padding: 0px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
}

.pool-table-empty {
  padding: 32px;
  text-align: center;
}

/* 资金池页头 */
.capital-pool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.capital-pool-actions {
  display: flex;
  gap: 8px;
}

/* 卡片折叠（主人口令 2026-08-22）：常规只看关键实时信息，展开看全部 */
.card-summary {
  margin: 4px 0 0px;
}

.card-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px solid #f7f7f7;
}

.card-summary-row:last-child {
  border-bottom: none;
}

.card-detail[hidden] {
  display: none;
}

.card-detail {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.card-expand-toggle {
  border-radius: 999px;
}

.card-expanded {
  box-shadow: var(--shadow-card);
}

/* 资金池三饼布局（主人口令 2026-08-22：总饼 + 两池个股构成饼） */
.capital-pie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1100px) {
  .capital-pie-grid {
    grid-template-columns: 1fr;
  }
}

.capital-pie-title {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.capital-pie-canvas {
  width: 100%;
  height: 240px;
}

.capital-pie-empty {
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* KC-20260829-004：组合总览入口（一级仓行末位，虚线框区分板块链接） */
.wh-tab-portfolio {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-left: 8px;
}

.monthly-note-body {
  line-height: 1.7;
  font-size: 0.9rem;
}

/* KC-20260829-005：持仓概览统计卡（整卡可点） */
.position-overview-card {
  text-decoration: none;
  color: var(--text);
  display: block;
}

.position-overview-card:hover {
  text-decoration: none;
  border-color: var(--primary);
}

/* KC-20260829-008：机动仓两区额度条 */
.zone-quota-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.zone-quota-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.zone-quota-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.zone-quota-value {
  font-size: 1.4rem;
  font-weight: 700;
}

/* KC-20260829-011：表格行内展开区 */
.cards-expand-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.cards-expand-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 0.85rem;
}

.cards-expand-monitor {
  flex-basis: 100%;
}

.cards-table th[data-sort]:hover {
  color: var(--primary);
}

.capital-pie-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1100px) {
  .capital-pie-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.trend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.trend-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.trend-canvas {
  height: 240px;
}

/* KC-20260829-011 R2：数字列内边距收窄一档（不动字号） */
.cards-table th,
.cards-table td {
  padding: 8px 8px;
}

/* R2：组合总览趋势区空态占位虚线框 */
.trend-placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
