/* Production shell for the AI command center; feature-level styles remain in style.css. */
body, body[data-theme] {
  --bg: #091019; --card: #151f2d; --text: #f3f6fb; --muted: #94a3b8;
  --accent: #8290ff; --accent-weak: #202a47; --user-bg: #1d2a4a;
  --user-text: #f3f6fb; --border: #2a394e; --danger: #ff8392; --glow: transparent;
  background: var(--bg); color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-screen { background: radial-gradient(circle at 50% 0, #1c2b55, #091019 62%); }
.login-card { width: min(390px, calc(100vw - 32px)); padding: 32px; background: #151f2d; border: 1px solid #35445b; box-shadow: 0 28px 80px #0007; }
.login-mark { width: 48px; height: 48px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 14px; background: #263468; color: #abb6ff; font-size: 25px; }
.login-card h1 { font-size: 23px; }
.login-card input { background: #0d1622; color: var(--text); }
.login-card button { background: #7787ff; }

.command-app { width: 100%; max-width: none; height: 100dvh; margin: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr) 282px; overflow: hidden; background: #091019; }
.side-nav { min-width: 0; display: flex; flex-direction: column; padding: 22px 13px 15px; background: #101824; border-right: 1px solid var(--border); }
.console-brand { display: flex; align-items: center; gap: 10px; padding: 0 7px 22px; font-weight: 800; letter-spacing: .09em; font-size: 13px; }
.console-brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .02em; }
.console-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #7584f8; color: white; font-size: 19px; }
.new-session { width: 100%; padding: 11px; border: 1px solid #5968bf; border-radius: 9px; background: #1d2845; color: #e4e8ff; font-size: 13px; font-weight: 650; text-align: left; }
.new-session:hover { background: #27365e; }
.view-switch { display: grid; gap: 5px; padding: 18px 0 15px; background: transparent; border: 0; }
.view-tab { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; font-weight: 500; }
.view-tab span { width: 18px; color: #8290ff; text-align: center; font-size: 17px; }
.view-tab:hover { color: var(--text); background: #182235; }
.view-tab.active { color: #bcc5ff; background: #1c2946; border: 0; }
.history-panel { min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); padding-top: 13px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 9px; color: #a8b5c8; font-size: 11px; font-weight: 700; letter-spacing: .07em; }
.history-heading button { border: 0; background: transparent; color: var(--muted); font-size: 17px; }
.history-search { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #0d1622; color: var(--text); font-size: 12px; }
.history-list { min-height: 0; overflow-y: auto; padding-top: 8px; }
.history-hint { padding: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.history-row { display: flex; align-items: stretch; border-radius: 8px; }
.history-row:hover { background: #1b2738; }
.history-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 10px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.history-open.is-current { background: #202d49; }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.history-open small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.history-delete { width: 25px; border: 0; background: transparent; color: #718198; font-size: 17px; }
.history-delete:hover { color: var(--danger); }
.side-foot { display: flex; align-items: center; gap: 7px; margin-top: auto; padding: 13px 5px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.online-dot, .topbar-status i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #45d6c8; box-shadow: 0 0 10px #45d6c866; }
.side-foot .logout { margin-left: auto; padding: 4px 6px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }

.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { min-height: 74px; padding: 12px 24px; background: #101824; }
.brand-text .eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.brand-text h1 { margin: 2px 0; font-size: 17px; }
.model-name { color: #a7b2ff; font-size: 11px; }
.mascot { width: 39px; height: 39px; border: 1px solid #40516b; }
.topbar-status { display: flex; align-items: center; gap: 6px; color: #68d7c8; font-size: 11px; }
.model-controls { display: flex; align-items: center; gap: 7px; }
.controls select { max-width: 150px; background: #172334; color: var(--text); }
.command-app[data-view="multi"] .model-controls, .command-app[data-view="agent"] .model-controls, .command-app[data-view="notes"] .model-controls { display: none; }
.workspace > section { min-width: 0; min-height: 0; flex: 1; }
.view-intro { padding: 25px 26px 16px; }
.section-kicker { color: #8d9cff; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.view-intro h2 { margin: 6px 0; font-size: clamp(20px, 2.4vw, 28px); font-weight: 700; letter-spacing: -.025em; }
.view-intro p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
#chat-view { display: flex; flex-direction: column; }
.openrouter-config { margin: 0 26px 12px; padding: 13px 15px; border: 1px solid #43587c; border-radius: 10px; background: #162338; }
.openrouter-fields { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.openrouter-fields label { color: #bdc8de; font-size: 11px; white-space: nowrap; }
.openrouter-fields input { min-width: 150px; flex: 1; padding: 9px 11px; border: 1px solid #405573; border-radius: 8px; background: #0d1622; color: var(--text); font-size: 12px; }
.openrouter-config p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.openrouter-config p.unsafe { color: #ffb88d; }
.messages { padding: 16px 26px 24px; }
.welcome { border: 1px dashed #34455c; border-radius: 12px; margin: auto; padding: 35px; }
.msg { max-width: min(78%, 760px); padding: 13px 16px; }
.msg.user { border: 1px solid #465796; }
.msg.ai { background: #151f2d; }
.msg.warn { background: #2f2a1e; color: #f4d588; border-color: #7b6534; }
.composer { gap: 12px; padding: 15px 26px 20px; background: #091019; border-top: 1px solid var(--border); }
.composer textarea { background: #151f2d; color: var(--text); border-radius: 10px; padding: 13px 14px; }
.composer button { min-width: 96px; padding: 12px 17px; background: #7787ff; font-weight: 700; }

#multi-view { display: flex; }
.multi-shell { width: 100%; }
.multi-selector { margin: 0 26px 14px; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--card); }
.multi-selector-head { flex-wrap: wrap; }
.multi-title { font-size: 12px; }
.multi-count { font-size: 11px; }
.mvt, .mvt-reset { padding: 6px 10px; font-size: 11px; }
.mvt.active { background: #283668; color: #dfe4ff; }
.ai-chip { border-radius: 8px; padding: 8px 11px; font-size: 11px; background: #1b2737; }
.ai-chip.selected { background: #283668; color: #f3f6fb; border-color: #6778d8; }
.multi-compare { padding: 0 26px 18px; }
.multi-empty { border: 1px dashed #34455c; border-radius: 11px; padding: 40px 18px; }
.multi-round { gap: 13px; }
.multi-round-q { align-self: flex-end; max-width: 90%; padding: 12px 16px; border: 1px solid #475696; border-radius: 12px 12px 4px 12px; background: #1b2744; font-size: 13px; font-weight: 500; }
.multi-round-row { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.ai-card { min-height: 175px; border-radius: 11px; }
.ai-card-head { flex-wrap: wrap; background: #1b2737; padding: 10px 12px; }
.ai-card-name { color: #c4ccff; }
.ai-card-state.done { background: #183d38; color: #7ee3c9; }
.ai-card-state.failed { background: #493039; color: #ff9bab; }
.ai-card-body { color: #d6dfeb; line-height: 1.65; }
.multi-synthesis { min-height: 0; overflow-y: auto; margin: 0 26px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--card); }
.multi-composer { padding: 15px 26px 20px; }

#agent-view { overflow-y: auto; }
.agent-panel { padding: 0 26px 24px; }
.agent-panel .view-intro { padding-left: 0; padding-right: 0; }
.agent-config { padding: 17px; background: var(--card); }
.agent-row select, .agent-task, .agent-cwd, #codex-access { background: #0f1927; color: var(--text); }
.agent-output { background: #0d1622; }
.agent-thread { margin-top: 12px; }

#notes-view { overflow-y: auto; }
.notes-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(240px, 1fr); gap: 13px; overflow-y: auto; padding: 0 26px 24px; }
.notes-shell .view-intro { padding-left: 0; padding-right: 0; }
.notes-compose, .notes-list { background: var(--card); }
.notes-compose-head, .notes-list-head { background: #1b2737; }
.note-title, .note-content { background: #101a28; }
.notes-list { min-height: 230px; }

.inspector { min-width: 0; min-height: 0; overflow-y: auto; padding: 22px 16px; background: #101824; border-left: 1px solid var(--border); }
.inspector-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 1px 16px; font-size: 14px; font-weight: 700; }
.inspector-mark { color: #a9b4ff; }
.inspector-section { padding: 17px 1px; border-top: 1px solid var(--border); }
.inspector-section small { display: block; margin-bottom: 10px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.inspector-section strong { display: block; font-size: 15px; }
.inspector-section p { margin: 8px 0 0; color: #aab8c9; font-size: 12px; line-height: 1.7; }
.status-line { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0; font-size: 11px; }
.status-line span { color: var(--muted); }
.status-line b { max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.status-line .good { color: #5fd5c5; }
.inspector .agent-files { display: none; margin-top: 6px; }
.command-app[data-view="agent"] .inspector .agent-files { display: block; }
.agent-files-head { flex-wrap: wrap; }
.agent-files-path { max-width: 100%; }

@media (max-width: 1100px) {
  .command-app { grid-template-columns: 205px minmax(0, 1fr); }
  .inspector { display: none; }
  .command-app[data-view="agent"] { grid-template-rows: minmax(0, 1fr) 220px; }
  .command-app[data-view="agent"] .side-nav { grid-row: 1 / 3; }
  .command-app[data-view="agent"] .workspace { grid-column: 2; grid-row: 1; }
  .command-app[data-view="agent"] .inspector { display: block; grid-column: 2; grid-row: 2; border-top: 1px solid var(--border); border-left: 0; padding: 10px 16px; }
  .command-app[data-view="agent"] .inspector-heading, .command-app[data-view="agent"] .inspector-section { display: none; }
}
@media (max-width: 700px) {
  .command-app { display: flex; flex-direction: column; overflow: auto; height: 100dvh; }
  .side-nav { flex: 0 0 auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .console-brand { padding: 0 0 9px; }
  .new-session { position: absolute; top: 13px; right: 12px; width: auto; padding: 8px 10px; font-size: 11px; }
  .view-switch { display: flex; overflow-x: auto; gap: 4px; padding: 5px 0; }
  .view-tab { flex: 0 0 auto; width: auto; padding: 8px; font-size: 11px; }
  .history-panel { padding-top: 7px; }
  .history-search { padding: 6px 8px; }
  .history-list { display: flex; gap: 4px; overflow-x: auto; padding-top: 4px; }
  .history-row { flex: 0 0 150px; }
  .history-open small { font-size: 9px; }
  .side-foot { display: none; }
  .workspace { min-height: 0; flex: 1; }
  .topbar { min-height: 56px; padding: 8px 14px; }
  .topbar-status { display: none; }
  .controls select { max-width: 80px; font-size: 10px; }
  .model-controls { flex-wrap: wrap; justify-content: flex-end; }
  .model-controls label { display: none; }
  .view-intro { padding: 15px 15px 10px; }
  .multi-selector { margin: 0 15px 10px; padding: 10px; }
  .multi-view-toggle { width: 100%; }
  .multi-compare { padding: 0 15px 10px; }
  .multi-round-row { grid-template-columns: 1fr; }
  .multi-synthesis { margin: 0 15px 10px; }
  .composer { padding: 10px 15px; }
  .composer button { min-width: 72px; padding: 10px; font-size: 12px; }
  .agent-panel { padding: 0 15px 18px; }
  .notes-shell { padding: 0 15px 18px; }
  .command-app[data-view="agent"] .inspector { flex: 0 0 185px; overflow: auto; }
}

/* ---------- 明暗主题切换（外壳层追加，不动上方布局） ---------- */
.scheme-toggle { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text); font-size: 16px; line-height: 1; padding: 0; }
.scheme-toggle:hover { background: var(--accent-weak); border-color: var(--accent); }
@media (max-width: 700px) { .scheme-toggle { width: 30px; height: 30px; font-size: 14px; } }

/* 亮色主题：覆盖上方暗色外壳的变量与硬编码颜色，布局规则一律不变 */
body[data-scheme="light"] {
  --bg: #f3f5fa; --card: #ffffff; --text: #1c2433; --muted: #68758a;
  --accent: #4f5fe0; --accent-weak: #e6e9ff; --user-bg: #4f5fe0; --user-text: #ffffff;
  --border: #d8deea; --danger: #d13a4e; --glow: transparent;
  background: var(--bg); color: var(--text);
}
body[data-scheme="light"] .login-screen { background: radial-gradient(circle at 50% 0, #dfe6f8, #f7f9fd 62%); }
body[data-scheme="light"] .login-card { background: #ffffff; border-color: #d8deea; box-shadow: 0 28px 80px #1c24331f; }
body[data-scheme="light"] .login-mark { background: #e6e9ff; color: #4f5fe0; }
body[data-scheme="light"] .login-card input { background: #ffffff; }
body[data-scheme="light"] .login-card button { background: #4f5fe0; }
body[data-scheme="light"] .command-app { background: var(--bg); }
body[data-scheme="light"] .side-nav { background: #f7f9fd; }
body[data-scheme="light"] .console-logo { background: #e6e9ff; color: #4f5fe0; }
body[data-scheme="light"] .new-session { background: #ffffff; border-color: #aab6e6; color: #3a4767; }
body[data-scheme="light"] .new-session:hover { background: #eef2ff; }
body[data-scheme="light"] .view-tab span { color: #4f5fe0; }
body[data-scheme="light"] .view-tab:hover { color: var(--text); background: #e8edf7; }
body[data-scheme="light"] .view-tab.active { color: #3f4fc4; background: #dfe5f6; }
body[data-scheme="light"] .history-heading { color: #4b5770; }
body[data-scheme="light"] .history-search { background: #ffffff; }
body[data-scheme="light"] .history-row:hover { background: #e9eef8; }
body[data-scheme="light"] .history-open.is-current { background: #dfe6f6; }
body[data-scheme="light"] .topbar { background: #ffffff; }
body[data-scheme="light"] .model-name { color: #4f5fe0; }
body[data-scheme="light"] .mascot { border-color: #c9d2e4; }
body[data-scheme="light"] .topbar-status { color: #17977f; }
body[data-scheme="light"] .controls select { background: #ffffff; }
body[data-scheme="light"] .section-kicker { color: #4f5fe0; }
body[data-scheme="light"] .welcome { border-color: #c3ccdf; }
body[data-scheme="light"] .msg.user { border-color: #a9b6e8; }
body[data-scheme="light"] .msg.ai { background: var(--card); }
body[data-scheme="light"] .msg.warn { background: #fff7e0; color: #8a6d1f; border-color: #e0c26a; }
body[data-scheme="light"] .composer { background: var(--bg); }
body[data-scheme="light"] .composer textarea { background: #ffffff; }
body[data-scheme="light"] .composer button { background: #4f5fe0; }
body[data-scheme="light"] .multi-empty { border-color: #c3ccdf; }
body[data-scheme="light"] .multi-round-q { border-color: #a9b6e8; background: #e7ebf7; }
body[data-scheme="light"] .ai-chip { background: #eef1f8; }
body[data-scheme="light"] .ai-chip.selected { background: #dfe5f6; color: #1c2433; border-color: #4f5fe0; }
body[data-scheme="light"] .mvt.active { background: #dfe5f6; color: #3f4fc4; }
body[data-scheme="light"] .ai-card-head { background: #f2f4fa; }
body[data-scheme="light"] .ai-card-name { color: #3f4fc4; }
body[data-scheme="light"] .ai-card-state.done { background: #dff5ee; color: #0f8a6d; }
body[data-scheme="light"] .ai-card-state.failed { background: #fde8ee; color: #c93550; }
body[data-scheme="light"] .ai-card-body { color: #2a3648; }
body[data-scheme="light"] .agent-row select,
body[data-scheme="light"] .agent-task,
body[data-scheme="light"] .agent-cwd,
body[data-scheme="light"] #codex-access { background: #ffffff; }
body[data-scheme="light"] .agent-output { background: #f7f9fd; }
body[data-scheme="light"] .notes-compose-head,
body[data-scheme="light"] .notes-list-head { background: #f2f4fa; }
body[data-scheme="light"] .note-title,
body[data-scheme="light"] .note-content { background: #ffffff; }
body[data-scheme="light"] .inspector { background: #f7f9fd; }
body[data-scheme="light"] .inspector-section p { color: #3f4a5f; }
body[data-scheme="light"] .status-line .good { color: #0f8a6d; }
