/* ============ 深色模式 ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7efe8;
  --muted: #93a396;
  --line: #26332b;
  --green: #7cc6a2;
  --rail: #111a15;
  background: #0f1512;
  color: var(--ink);
}

html[data-theme="dark"] body {
  background: #0f1512;
  color: var(--ink);
}

/* --- 切换按钮 --- */
.theme-switch {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 80;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f6f1;
  color: #3c5a49;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.theme-switch:hover { background: #eeeee7; }
.theme-switch svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
.theme-switch .i-moon { display: none; }
html[data-theme="dark"] .theme-switch { background: #18211c; border-color: #2c3a31; color: #d7e6da; }
html[data-theme="dark"] .theme-switch:hover { background: #1f2b24; }
html[data-theme="dark"] .theme-switch .i-sun { display: none; }
html[data-theme="dark"] .theme-switch .i-moon { display: block; }

.masthead { padding-right: 56px; }
.app main > header { padding-right: 56px; }

/* ============ 首页 / 项目研究 ============ */
html[data-theme="dark"] .brand span { color: #6e8174; border-color: #26332b; }
html[data-theme="dark"] .reports-link { color: #a9b8a9; }
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .lead,
html[data-theme="dark"] .report-list p,
html[data-theme="dark"] .hero-sub,
html[data-theme="dark"] .task-intro > p,
html[data-theme="dark"] .deliverables p,
html[data-theme="dark"] .waiting { color: #93a396; }

html[data-theme="dark"] .search-box {
  background: #151e18;
  border-color: #29372e;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .search-box > svg { color: #7d8f7e; }
html[data-theme="dark"] .search-box input { color: var(--ink); }
html[data-theme="dark"] .search-box input::placeholder { color: #718174; }
html[data-theme="dark"] .search-box:focus-within { border-color: #4c7a5f; box-shadow: 0 0 0 3px rgba(124, 198, 162, .12); }
html[data-theme="dark"] .search-box button,
html[data-theme="dark"] .primary { background: #2f5c46; color: #f2f8f1; }
html[data-theme="dark"] .search-box button:hover,
html[data-theme="dark"] .primary:hover { background: #3b6f55; }
html[data-theme="dark"] .examples,
html[data-theme="dark"] .search-progress { color: #85968a; }
html[data-theme="dark"] .examples button { color: #9fb3a1; }
html[data-theme="dark"] .shell > footer { color: #77897b; }

html[data-theme="dark"] .tender-row { border-bottom-color: var(--line); }
html[data-theme="dark"] .tender-row.selected { background: #1a2a20; border-left-color: #8fd0ae; }
html[data-theme="dark"] .tender-row time { color: #84958a; }
html[data-theme="dark"] .tender-row p { color: #9aab9b; }
html[data-theme="dark"] .tender-row span { color: #8fa190; }
html[data-theme="dark"] .tender-row > svg { color: #7f927f; }

html[data-theme="dark"] .project-panel { background: #141d18; border-color: #27352c; }
html[data-theme="dark"] .project-panel dt { color: #8e9f90; }
html[data-theme="dark"] .generation p { color: #9aab9b; }
html[data-theme="dark"] .generation small { color: #8b9c8d; }
html[data-theme="dark"] .empty { color: #8a9c8b; }

html[data-theme="dark"] .task-status { background: #17231c; }
html[data-theme="dark"] .task-status p { color: #9aab9b; }
html[data-theme="dark"] .timeline summary,
html[data-theme="dark"] .gaps summary { color: #a7b6a7; }
html[data-theme="dark"] .timeline time { color: #84958a; }
html[data-theme="dark"] .timeline p { color: #8fa190; }

html[data-theme="dark"] .veil { background: rgba(4, 8, 6, .62); }
html[data-theme="dark"] .modal { background: #161f19; box-shadow: 0 24px 80px rgba(0, 0, 0, .55); }
html[data-theme="dark"] .notice-source { color: #8c9d8e; }
html[data-theme="dark"] .access-form input,
html[data-theme="dark"] .access-form select { background: #131c17; border-color: #2c3b31; color: var(--ink); }
html[data-theme="dark"] .toast { background: #25382c; color: #eef6ec; }

/* ============ 进度 / 任务控制 ============ */
html[data-theme="dark"] .task-progress { background: #141d18; }
html[data-theme="dark"] .progress-caption,
html[data-theme="dark"] .progress-heading strong span,
html[data-theme="dark"] .progress-note { color: #93a396; }
html[data-theme="dark"] .progress-track { background: #26332b; }
html[data-theme="dark"] .progress-fill { background: #6fb894; }
html[data-theme="dark"] .is-paused .progress-fill { background: #c39a63; }
html[data-theme="dark"] .is-paused .progress-heading strong { color: #d8b27a; }
html[data-theme="dark"] .progress-stages { color: #8b9c8c; }
html[data-theme="dark"] .task-controls { background: #17231c; border-color: #26332b; }
html[data-theme="dark"] .task-controls > div strong { color: var(--ink); }
html[data-theme="dark"] .task-controls > div p,
html[data-theme="dark"] .task-controls > p { color: #93a396; }
html[data-theme="dark"] .task-controls button:not(.primary) { background: transparent; border-color: #33443a; color: #cfe0d3; }
html[data-theme="dark"] .task-controls button:not(.primary):hover { background: #1f2b24; }
html[data-theme="dark"] .task-approval { background: #2a2318; border-color: #463a22; }
html[data-theme="dark"] .task-approval p { color: #cbb894; }
html[data-theme="dark"] .task-approval textarea,
html[data-theme="dark"] .task-approval select { background: #191510; border-color: #4a3d24; color: var(--ink); }
html[data-theme="dark"] .active-run { background: #16211b; border-color: #2a3830; }
html[data-theme="dark"] .active-run-head { color: #9fb0a1; }
html[data-theme="dark"] .active-run-head span,
html[data-theme="dark"] .active-run-head b { color: #7cc6a2; }
html[data-theme="dark"] .active-run-head em { color: #8a9c8b; }
html[data-theme="dark"] .active-run-track { background: #26332b; }
html[data-theme="dark"] .active-run-fill { background: #6fb894; }

/* ============ 审核端（review.html） ============ */
html[data-theme="dark"] .app aside { background: #111a15; }
html[data-theme="dark"] .app .wordmark { color: var(--ink); }
html[data-theme="dark"] .app nav button { color: #a9b8a9; }
html[data-theme="dark"] .app nav button:hover { background: #1b2620; }
html[data-theme="dark"] .app nav button.active { background: #1c352c; color: #a7e3c9; }
html[data-theme="dark"] .app .sidebar-bottom span { color: #93a396; }
html[data-theme="dark"] .app .sidebar-bottom small { color: #7f9184; }
html[data-theme="dark"] .app .sidebar-bottom button { color: #a9b8a9; }

html[data-theme="dark"] .app button,
html[data-theme="dark"] .app .button { background: #18231d; border-color: #2c3a31; color: var(--ink); }
html[data-theme="dark"] .app button:hover,
html[data-theme="dark"] .app .button:hover { background: #1f2d25; border-color: #3d6152; }
html[data-theme="dark"] .app .primary { background: #2b6a55; border-color: #2b6a55; color: #f2f8f1; }
html[data-theme="dark"] .app .primary:hover { background: #357d65; border-color: #357d65; }
html[data-theme="dark"] .app .text-button { color: #8fd0ae; }

html[data-theme="dark"] .app .project-form { border-color: var(--line); }
html[data-theme="dark"] .app label { color: #a9b8a9; }
html[data-theme="dark"] .app input:not([type=checkbox]),
html[data-theme="dark"] .app select,
html[data-theme="dark"] .app textarea { background: #131c17; border-color: #2c3a31; color: var(--ink); }
html[data-theme="dark"] .app input::placeholder,
html[data-theme="dark"] .app textarea::placeholder { color: #6f8073; }
html[data-theme="dark"] .app input:focus,
html[data-theme="dark"] .app select:focus,
html[data-theme="dark"] .app textarea:focus { box-shadow: 0 0 0 3px rgba(124, 198, 162, .14); }
html[data-theme="dark"] .app .required { color: #e08a7f; }

html[data-theme="dark"] .app .process li { color: #93a396; }
html[data-theme="dark"] .app .process li:not(:last-child):after { background: #33443a; }
html[data-theme="dark"] .app .process span { background: #24322a; color: #dfeae1; border-color: #33443a; }
html[data-theme="dark"] .app .process li.active span { background: #2b6a55; color: #f2f8f1; }
html[data-theme="dark"] .app .process strong { color: #cfe0d3; }

html[data-theme="dark"] .app th { background: #111a15; color: #a9b8a9; }
html[data-theme="dark"] .app td { border-top-color: var(--line); }
html[data-theme="dark"] .app td strong { color: var(--ink); }
html[data-theme="dark"] .app .subline { color: #8fa190; }
html[data-theme="dark"] .app .filters button { color: #a9b8a9; }
html[data-theme="dark"] .app .filters .selected { background: #1b2a21; color: #cfe0d3; }
html[data-theme="dark"] .app .muted { color: #8fa190; }

html[data-theme="dark"] .app .status { background: #1b2830; color: #a9b8c4; }
html[data-theme="dark"] .app .status.released { background: #18322b; color: #9fe0c6; }
html[data-theme="dark"] .app .status.running,
html[data-theme="dark"] .app .status.queued { background: #172431; color: #9dc0e8; }
html[data-theme="dark"] .app .status.awaiting_review { background: #2a2417; color: #e3c184; }

html[data-theme="dark"] .app .notice { background: #16211c; color: #8fcbb7; }
html[data-theme="dark"] .app .notice p { color: #9fb0a6; }
html[data-theme="dark"] .app .check-list button { background: #131c17; border-color: #2c3a31; color: var(--ink); }
html[data-theme="dark"] .app .check-list button.chosen { background: #1d332b; border-color: #357d65; }
html[data-theme="dark"] .app .file-input { border-color: #2e3e35; color: #a9b8a9; }
html[data-theme="dark"] .app .evidence-grid img { background: #101814; }
html[data-theme="dark"] .app pre { background: #101814; color: #cfe0d3; }
html[data-theme="dark"] .app .credit-card { background: #141d18; border-color: #26332b; }
html[data-theme="dark"] .app .toast { background: #2a1e18; color: #f0b9a4; border-color: #4a322a; }
html[data-theme="dark"] .app .timeline li:before { background: #0f1512; }

/* 已登录时的退出入口 */
.signout {
  position: fixed;
  right: 74px;
  top: 30px;
  z-index: 70;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  letter-spacing: 1px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.signout:hover { color: var(--ink); background: rgba(0,0,0,.04); }
html[data-theme="dark"] .signout:hover { background: rgba(255,255,255,.06); }

/* 顶部右侧工具区：我的报告 / 退出登录 / 主题切换 一排对齐 */
.masthead { position: relative; padding-right: 170px; }
.signout {
  position: fixed; right: 74px; top: 22px; height: 40px;
  display: flex; align-items: center; z-index: 80;
  padding: 0 10px; border-radius: 999px;
  color: var(--muted); font-size: 12px; letter-spacing: 1px; line-height: 1;
  text-decoration: none; transition: color .15s ease, background .15s ease;
}
.signout:hover { color: var(--ink); background: rgba(0,0,0,.05); }
html[data-theme="dark"] .signout:hover { background: rgba(255,255,255,.06); }
@media (max-width: 900px) {
  .masthead { padding-right: 140px; }
  .signout { right: 66px; }
}

html.classic-ui .signout { top: 36px; }
html.classic-ui .theme-switch { top: 36px; }
