:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #176b87;
  --danger: #b42318;
  --ok: #067647;
}

* { box-sizing: border-box; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; color: var(--text); }
.nav { display: flex; gap: 16px; }
.nav a.active {
  color: var(--text);
  font-weight: 800;
}
.logout { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.page { max-width: 1440px; margin: 0 auto; padding: 24px; overflow-x: hidden; }
.panel, .login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.panel + .panel {
  margin-top: 16px;
}
.collapse-panel {
  padding-top: 16px;
}
.section-summary {
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.section-summary::-webkit-details-marker {
  display: none;
}
.section-summary::before {
  content: "展开";
  display: inline-flex;
  min-width: 42px;
  margin-right: 10px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
}
.collapse-panel[open] > .section-summary::before {
  content: "收起";
}
.section-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.section-summary strong {
  font-size: 20px;
}
.section-summary small {
  color: var(--muted);
  font-size: 13px;
}
.collapse-panel > :not(summary) {
  margin-top: 16px;
}
.login-panel { max-width: 420px; margin: 80px auto; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 8px; }
.panel-head p, .muted, .empty { color: var(--muted); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stats div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.stats strong { display: block; font-size: 24px; }
.stats span { color: var(--muted); }
.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}
.source-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 0.9fr);
  gap: 20px;
  align-items: start;
}
.source-form-stack {
  display: grid;
  gap: 16px;
}
.source-form-card .panel-head {
  display: block;
}
.timeline { display: grid; gap: 14px; }
.timeline-loader {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  background: #fff;
  color: var(--accent);
  border-color: var(--line);
}
.timeline-loader[hidden],
.timeline-error[hidden] {
  display: none;
}
.timeline-error {
  margin-top: 12px;
}
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}
.result-card h2 { margin-bottom: 8px; font-size: 17px; }
.result-meta, .links, .chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.result-meta { color: var(--muted); margin-bottom: 8px; }
.summary { color: #344054; }
.translation-block { white-space: pre-wrap; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #eef6f8;
  color: var(--accent);
  font-weight: 700;
  flex: 0 0 auto;
}
.avatar-small {
  width: 24px;
  height: 24px;
  font-size: 12px;
}
.transcript-full {
  max-height: 520px;
  overflow: auto;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 16px 18px;
  color: #253040;
  font: 14px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.transcript-full p {
  margin: 0 0 14px;
  text-indent: 2em;
}
.transcript-full p:last-child { margin-bottom: 0; }
.chips span, .status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: #f8fafc;
}
.status-parsed { color: var(--ok); border-color: #abefc6; background: #ecfdf3; }
.status-download_failed, .status-failed { color: var(--danger); border-color: #fecdca; background: #fef3f2; }
.source-type-collection { color: #854a0e; border-color: #fedf89; background: #fffaeb; }
.source-type-posts { color: var(--accent); border-color: #b8d8e2; background: #eef6f8; }
.source-type-youtube_channel,
.source-type-youtube_playlist { color: #b42318; border-color: #fecdca; background: #fef3f2; }
.source-type-bilibili_user_video { color: #175cd3; border-color: #b2ccff; background: #eff4ff; }
.source-type-wechat_homepage,
.source-type-wechat_album { color: #087443; border-color: #abefc6; background: #ecfdf3; }
.source-type-zsxq_group { color: #6941c6; border-color: #d9d6fe; background: #f4f3ff; }
.source-type-twitter_user { color: #026aa2; border-color: #b9e6fe; background: #f0f9ff; }
.source-type-truthsocial_user { color: #344054; border-color: #cfd4dc; background: #f9fafb; }
.platform-douyin,
.platform-douyin_collection { color: #854a0e; border-color: #fedf89; background: #fffaeb; }
.platform-youtube { color: #b42318; border-color: #fecdca; background: #fef3f2; }
.platform-bilibili { color: #175cd3; border-color: #b2ccff; background: #eff4ff; }
.platform-wechat { color: #087443; border-color: #abefc6; background: #ecfdf3; }
.platform-zsxq { color: #6941c6; border-color: #d9d6fe; background: #f4f3ff; }
.platform-twitter { color: #026aa2; border-color: #b9e6fe; background: #f0f9ff; }
.platform-truthsocial { color: #344054; border-color: #cfd4dc; background: #f9fafb; }
table { width: 100%; border-collapse: collapse; }
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table {
  min-width: 640px;
}
.blogger-table {
  min-width: 980px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; }
.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
input, select, textarea, button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
}
textarea {
  width: 100%;
  resize: vertical;
}
button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
button:disabled,
textarea:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
button.danger { background: var(--danger); border-color: var(--danger); }
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  font-weight: 700;
}
.strategy-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { min-height: auto; }
.table-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 16px; }
.inline-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-edit input { min-width: 160px; }
.inline-edit button { min-width: 54px; }
.inline-edit-wide input { min-width: 260px; max-width: 420px; }
.user-table {
  min-width: 980px;
}
.user-access-form,
.password-reset-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-access-form select {
  min-width: 110px;
}
.password-reset-form input {
  min-width: 190px;
}
.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}
.role-pill.role-admin {
  border-color: #b2ccff;
  background: #eff4ff;
  color: #175cd3;
}
.role-pill.role-viewer {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}
.role-help-list {
  display: grid;
  gap: 8px;
}
.role-help-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}
.role-help-list p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.readonly-link {
  display: block;
  max-width: 320px;
  overflow-wrap: anywhere;
}
.filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fbfcfe;
}
.strategy-board {
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 16px;
  margin-bottom: 16px;
}
.strategy-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.strategy-head h2 {
  margin-bottom: 4px;
}
.eyebrow {
  margin-bottom: 4px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.strategy-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.strategy-card {
  border: 1px solid var(--line);
  border-left: 4px solid #98a2b3;
  border-radius: 8px;
  padding: 13px;
  background: #fff;
  min-width: 0;
}
.strategy-card h3 {
  margin: 0 0 2px;
  font-size: 16px;
}
.strategy-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.strategy-card-top p,
.strategy-summary,
.strategy-action,
.strategy-empty {
  margin-bottom: 8px;
}
.strategy-card-top p {
  color: var(--muted);
  font-size: 12px;
}
.strategy-task-meta {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.strategy-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.strategy-label,
.confidence,
.task-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.strategy-label {
  background: #eef2f6;
  color: #314459;
}
.confidence {
  background: #f7f5ef;
  color: #6b5a2a;
}
.task-status {
  background: #eef6f8;
  color: var(--accent);
}
.task-failed {
  background: #fef3f2;
  color: var(--danger);
}
.strategy-偏多 {
  border-left-color: #12b76a;
}
.strategy-偏多 .strategy-label {
  background: #ecfdf3;
  color: #067647;
}
.strategy-偏空 {
  border-left-color: #f04438;
}
.strategy-偏空 .strategy-label {
  background: #fef3f2;
  color: #b42318;
}
.strategy-分歧 {
  border-left-color: #f79009;
}
.strategy-分歧 .strategy-label {
  background: #fffaeb;
  color: #b54708;
}
.strategy-summary {
  color: #263746;
}
.strategy-action {
  color: #344054;
}
.strategy-empty {
  color: var(--muted);
  font-size: 13px;
}
.strategy-evidence {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.strategy-evidence summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}
.strategy-evidence ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.strategy-evidence li {
  margin-bottom: 8px;
}
.strategy-evidence span,
.strategy-evidence small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.strategy-home-head .strategy-board {
  margin-bottom: 0;
}
#strategy-prompts {
  scroll-margin-top: 88px;
}
.strategy-empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fbfcfe;
}
.strategy-empty-state h2 {
  margin-bottom: 6px;
}
.strategy-empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}
.strategy-history-list {
  display: grid;
  gap: 10px;
}
.strategy-history-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.strategy-history-record summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
}
.strategy-history-record summary span {
  min-width: 0;
}
.strategy-history-record summary span:last-child {
  color: var(--muted);
  text-align: right;
}
.strategy-history-scroll {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}
.strategy-compare-table {
  min-width: 1120px;
}
.strategy-compare-table th,
.strategy-compare-table td {
  text-align: center;
  white-space: nowrap;
}
.strategy-compare-table th:first-child,
.strategy-compare-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
}
.strategy-mini-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f6;
  color: #314459;
  font-size: 12px;
  font-weight: 800;
}
.strategy-mini-label.strategy-偏多 {
  background: #ecfdf3;
  color: #067647;
}
.strategy-mini-label.strategy-偏空 {
  background: #fef3f2;
  color: #b42318;
}
.strategy-mini-label.strategy-分歧 {
  background: #fffaeb;
  color: #b54708;
}
.strategy-history-text-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.strategy-history-card {
  border: 1px solid var(--line);
  border-left: 4px solid #98a2b3;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.strategy-history-card h3 {
  margin-bottom: 2px;
}
.strategy-history-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.strategy-history-card-head p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}
.strategy-prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}
.strategy-prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  min-width: 0;
}
.strategy-prompt-card.prompt-disabled {
  background: #fbfcfe;
}
.strategy-prompt-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.strategy-prompt-head h3 {
  margin-bottom: 2px;
  font-size: 16px;
}
.strategy-prompt-head p,
.strategy-prompt-terms {
  color: var(--muted);
  font-size: 12px;
}
.strategy-prompt-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.strategy-prompt-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f6;
  color: #314459;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.strategy-prompt-form {
  display: grid;
  gap: 10px;
}
.strategy-prompt-form textarea {
  min-height: 160px;
  font-size: 13px;
  line-height: 1.55;
}
.strategy-prompt-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.strategy-prompt-reset {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.model-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.model-config-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}
.model-config-disabled {
  opacity: 0.68;
}
.model-config-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.model-config-head h2 {
  margin-bottom: 2px;
}
.model-config-head p {
  color: var(--muted);
  font-size: 12px;
}
.model-config-tags,
.model-config-actions,
.model-config-options,
.model-config-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.model-config-tags {
  justify-content: flex-end;
}
.model-config-form {
  gap: 10px;
}
.model-config-form textarea,
.model-create-form textarea {
  min-height: 84px;
}
.model-config-actions {
  justify-content: flex-end;
  margin-top: 12px;
}
.model-config-preset-row > label {
  flex: 1 1 220px;
}
.filter-title {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.filter-title-secondary { margin-top: 14px; }
.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  background: #fff;
  font-weight: 500;
}
.today-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}
.daily-platform {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 8px;
}
.run-source-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.filter-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.analysis-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.related-stocks {
  margin: 12px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  overflow: hidden;
}
.related-stocks-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.related-stocks-head h4 {
  margin: 0;
  font-size: 15px;
}
.related-stocks-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.related-stock-table-wrap {
  overflow-x: auto;
}
.related-stock-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}
.related-stock-table th,
.related-stock-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.related-stock-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #f3f7fa;
}
.related-stock-table tr:last-child td {
  border-bottom: 0;
}
.source-badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.source-badge {
  background: #eef6f8;
  color: var(--accent);
}
.source-comment {
  background: #fff4dc;
  color: #8a5a00;
}
.source-video {
  background: #e9f6ef;
  color: #1d6f42;
}
.score-pill {
  background: #eef2f6;
  color: #314459;
}
.direction-bull {
  background: #e7f7ed;
  color: #197144;
}
.direction-bear {
  background: #fdebec;
  color: #9e2430;
}
.direction-neutral {
  background: #eef2f6;
  color: #465668;
}
.related-stock-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}
.discussion-samples {
  margin: 18px 0 0;
}
.discussion-samples h3 {
  margin-bottom: 10px;
}
.discussion-list {
  display: grid;
  gap: 10px;
}
.discussion-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfe;
}
.discussion-list p {
  margin: 8px 0 0;
  line-height: 1.6;
}
.discussion-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.discussion-meta strong {
  color: var(--text);
  font-size: 13px;
}
.discussion-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
}
#codex-chat {
  display: grid;
  grid-template-rows: auto minmax(280px, 56vh) auto;
}
.chat-shell {
  min-height: 280px;
  max-height: 56vh;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-color: #8aa4b2 #e8eef2;
  scrollbar-width: thin;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 16px;
}
.chat-shell::-webkit-scrollbar {
  width: 12px;
}
.chat-shell::-webkit-scrollbar-track {
  background: #e8eef2;
  border-left: 1px solid #d6e1e8;
  border-radius: 999px;
}
.chat-shell::-webkit-scrollbar-thumb {
  background: #8aa4b2;
  border: 3px solid #e8eef2;
  border-radius: 999px;
}
.chat-list {
  display: grid;
  gap: 12px;
}
.chat-message {
  width: min(900px, 100%);
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}
.chat-message.user {
  margin-left: auto;
  background: #eef6f8;
  border-color: #b9dce7;
}
.chat-message.assistant { margin-right: auto; }
.chat-message.pending {
  color: var(--muted);
  background: #fffaf0;
  border-color: #fedf89;
}
.chat-message.error {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}
.chat-summary {
  cursor: pointer;
  list-style-position: outside;
}
.chat-summary-main,
.chat-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.chat-preview {
  display: block;
  margin-top: 6px;
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-message[open] .chat-preview {
  display: none;
}
.chat-body {
  margin-top: 12px;
  color: #253040;
}
.chat-body p { margin: 0 0 10px; }
.chat-body p:last-child { margin-bottom: 0; }
.chat-body ul,
.chat-body ol {
  margin: 0 0 10px 20px;
  padding: 0;
}
.chat-body li { margin: 4px 0; }
.thinking-trace {
  border: 1px solid #c8d9e1;
  border-radius: 8px;
  background: #f3f8fa;
  margin-bottom: 12px;
  padding: 10px 12px;
}
.thinking-trace summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}
.thinking-trace ol {
  margin: 10px 0 0 20px;
}
.thinking-trace li {
  color: var(--muted);
}
.reasoning-trace {
  background: #fff;
}
.reasoning-trace ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.reasoning-trace li {
  display: grid;
  grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
  color: #344054;
}
.reasoning-trace li strong {
  color: var(--text);
  white-space: nowrap;
}
.reasoning-trace li span,
.trace-note,
.stream-status {
  color: var(--muted);
}
.trace-note {
  margin-top: 8px;
  font-size: 12px;
}
.stream-status {
  border-left: 3px solid #9cc9d7;
  padding-left: 8px;
}
.thinking-trace .trace-done {
  color: var(--ok);
}
.thinking-trace .trace-active {
  color: var(--accent);
  font-weight: 700;
}
.thinking-trace .trace-error {
  color: var(--danger);
  font-weight: 700;
}
.markdown-table-wrap {
  max-width: 100%;
  overflow: auto;
  margin: 10px 0;
}
.markdown-table {
  min-width: 520px;
  background: #fff;
}
.markdown-table th,
.markdown-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
}
.chat-meta time,
.chat-summary-main time { margin-left: auto; }
.chat-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: #fff;
  font-size: 12px;
}
.chat-form {
  display: grid;
}
.composer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.composer-box:focus-within {
  border-color: #8ab8c7;
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}
.chat-composer textarea {
  display: block;
  min-height: 110px;
  border: 0;
  border-radius: 0;
  padding: 12px;
  resize: vertical;
  background: transparent;
}
.chat-composer textarea:focus {
  outline: none;
}
.composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px;
  background: #fbfcfe;
}
.chat-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 260px;
  min-width: 0;
  gap: 10px;
}
.chat-pending-note {
  margin: 0 12px 10px;
  color: var(--muted);
}
.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}
.file-button[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.65;
  pointer-events: none;
}
.file-button input {
  display: none;
}
.composer-hint {
  color: var(--muted);
  font-size: 13px;
}
.composer-send {
  flex: 0 0 auto;
  margin-left: auto;
}
.attachment-list,
.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attachment-chip,
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}
.attachment-pill img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}
.chat-form button {
  justify-self: start;
  min-width: 128px;
}
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; }
.compact-head { margin-bottom: 12px; }
.log-dashboard {
  display: grid;
  gap: 16px;
}
.log-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.log-tabs a,
.ghost-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
}
.log-tabs a.active {
  background: #eef6f8;
  border-color: #9cc9d7;
  color: #124f65;
}
.log-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.log-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}
.log-kpis strong {
  display: block;
  font-size: 24px;
}
.log-kpis span {
  color: var(--muted);
}
.daily-run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.daily-run-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.daily-run-card h3 {
  margin: 8px 0;
  font-size: 15px;
}
.daily-run-card p {
  margin: 8px 0 0;
  color: #344054;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.daily-run-card.success { border-color: #abefc6; background: #fcfffd; }
.daily-run-card.partial { border-color: #fedf89; background: #fffdf5; }
.daily-run-card.failed { border-color: #fecdca; background: #fff7f6; }
.daily-run-card.not-run { background: #fbfcfe; }
.daily-card-top,
.daily-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.daily-card-top {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.daily-counts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  font-size: 12px;
}
.log-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.log-filter-form select {
  min-width: 170px;
}
.run-table {
  min-width: 980px;
}
.run-table tr.selected td {
  background: #eef6f8;
}
.run-headline {
  max-width: 520px;
  color: #253040;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.run-table small {
  color: var(--muted);
}
.status-pill,
.trigger-pill,
.stage-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.success { color: var(--ok); border-color: #abefc6; background: #ecfdf3; }
.status-pill.partial { color: #b54708; border-color: #fedf89; background: #fffaeb; }
.status-pill.failed { color: var(--danger); border-color: #fecdca; background: #fef3f2; }
.status-pill.running { color: var(--accent); border-color: #b9dce7; background: #eef6f8; }
.status-pill.not-run { color: var(--muted); background: #f8fafc; }
.trigger-pill.scheduled { color: #067647; border-color: #abefc6; background: #ecfdf3; }
.trigger-pill.manual { color: #175cd3; border-color: #b2ccff; background: #eff4ff; }
.stage-pill {
  color: #344054;
  background: #f8fafc;
}
.log-list { display: grid; gap: 8px; }
.log-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.log-row {
  display: grid;
  grid-template-columns: 160px 70px 110px 70px 1fr;
  gap: 12px;
  align-items: start;
}
.log-row p, .log-list p { margin: 0; }
.log-row.error { border-color: #fecdca; background: #fff7f6; }
.alert {
  border: 1px solid #fecdca;
  color: var(--danger);
  background: #fef3f2;
  border-radius: 8px;
  padding: 10px;
}
.alert.success {
  border-color: #abefc6;
  color: var(--ok);
  background: #ecfdf3;
}
@media (max-width: 900px) {
  .grid-two,
  .source-layout { grid-template-columns: 1fr; }
  .topbar { height: auto; align-items: flex-start; flex-direction: column; padding: 12px; }
  .logout { margin-left: 0; }
  .log-row { grid-template-columns: 1fr; }
  .log-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
    line-height: 1.6;
  }
  .topbar {
    gap: 10px;
  }
  .brand {
    font-size: 16px;
  }
  .nav {
    width: 100%;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .logout {
    width: 100%;
    justify-content: space-between;
  }
  .logout button {
    min-width: 72px;
  }
  .page {
    padding: 12px;
  }
  .panel,
  .login-panel {
    padding: 14px;
  }
  .panel-head {
    display: block;
  }
  .strategy-history-record summary {
    display: block;
  }
  .strategy-history-record summary span {
    display: block;
  }
  .strategy-history-record summary span:last-child {
    margin-top: 4px;
    text-align: left;
  }
  .strategy-prompt-grid {
    grid-template-columns: 1fr;
  }
  #strategy-prompts {
    scroll-margin-top: 150px;
  }
  .strategy-prompt-head,
  .strategy-prompt-actions {
    display: block;
  }
  .strategy-prompt-meta {
    justify-content: flex-start;
    margin-top: 8px;
  }
  .strategy-prompt-actions button,
  .strategy-prompt-reset button {
    width: 100%;
    margin-top: 8px;
  }
  .panel-head h1,
  .panel-head h2 {
    margin-bottom: 6px;
  }
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stats div {
    padding: 12px;
  }
  .stats strong {
    font-size: 22px;
  }
  .filter-panel {
    padding: 10px;
  }
  .filter-options {
    gap: 7px;
  }
  .filter-chip {
    max-width: 100%;
  }
  .result-card {
    padding: 14px;
  }
  .result-card h2 {
    font-size: 16px;
    line-height: 1.45;
  }
  .result-meta,
  .links,
  .chips {
    gap: 7px;
  }
  #codex-chat {
    grid-template-rows: auto minmax(280px, 62vh) auto;
  }
  .chat-shell {
    min-height: 280px;
    max-height: 62vh;
    padding: 8px;
  }
  .chat-list {
    gap: 10px;
  }
  .chat-message {
    padding: 10px;
  }
  .chat-summary-main {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .chat-summary-main time {
    margin-left: 0;
  }
  .chat-preview {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .reasoning-trace li {
    grid-template-columns: 1fr;
  }
  .reasoning-trace li strong {
    white-space: normal;
  }
  .related-stocks-head {
    display: block;
  }
  .related-stocks-head p {
    margin-top: 4px;
  }
  .related-stock-table {
    min-width: 980px;
  }
  .chat-composer textarea {
    min-height: 120px;
    font-size: 15px;
  }
  .composer-footer {
    align-items: stretch;
  }
  .chat-tools {
    flex: 1 1 100%;
  }
  .composer-send {
    width: 100%;
    margin-left: 0;
  }
  .transcript-full {
    max-height: 62vh;
    padding: 14px;
    font-size: 15px;
    line-height: 1.75;
  }
  .transcript-full p {
    text-indent: 0;
  }
  .inline-form,
  .inline-edit,
  .user-access-form,
  .password-reset-form {
    flex-wrap: wrap;
  }
  .inline-form select,
  .inline-form button,
  .log-filter-form select,
  .log-filter-form button,
  .log-filter-form .ghost-button,
  .inline-edit input,
  .inline-edit button,
  .user-access-form select,
  .user-access-form button,
  .password-reset-form input,
  .password-reset-form button {
    width: 100%;
  }
  input,
  select,
  textarea,
  button {
    font-size: 15px;
  }
  .log-list.wide {
    gap: 10px;
  }
}
