:root {
  color: #e9edf6;
  background: #0d1018;
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif;
}
/* `hidden` 属性必须胜过任何 display 规则，否则 .login-screen/.app 的
   display:grid 会让面板切换失效（登录页盖不掉）。 */
[hidden] { display: none !important; }
body { margin: 0; }
h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: #8fa9d8; }
.eyebrow { color: #79a8ff; font-size: 12px; letter-spacing: .12em; }
input, textarea, select {
  background: #0d1018; border: 1px solid #3b465d; color: inherit; border-radius: 7px; padding: 10px; font: inherit; width: 100%; box-sizing: border-box;
}
button {
  width: fit-content; background: #5c8df6; color: #071226; border: 0; border-radius: 7px; padding: 10px 15px; font-weight: 700; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; color: #8fa9d8; border: 1px solid #3b465d; font-weight: 400; padding: 5px 11px; font-size: 13px; text-decoration: none; }
a.ghost { display: inline-block; }
output { display: block; color: #aebbd0; margin-top: 14px; overflow-wrap: anywhere; font-size: 13px; }

/* ---- 登录态 --------------------------------------------------------------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); background: #171c29; border: 1px solid #2b3345; border-radius: 14px; padding: 36px; }
.login-card h1 { font-size: 32px; margin: 6px 0 12px; }
.login-card p { color: #aebbd0; margin: 0 0 22px; }

/* ---- 应用态：顶栏 + 三栏 -------------------------------------------------- */
.app { height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 12px 20px;
  background: #11151f; border-bottom: 1px solid #2b3345;
}
.topbar .brand { display: flex; flex-direction: column; gap: 2px; }
.topbar .brand strong { font-size: 16px; }
.topbar-session { flex: 1; color: #aebbd0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: #8fa9d8; font-size: 13px; }

.grid { display: grid; grid-template-columns: 280px 1fr 360px; min-height: 0; }
.col { min-height: 0; display: flex; flex-direction: column; }
.col-left, .col-right { overflow-y: auto; padding: 18px; }
.col-left { border-right: 1px solid #2b3345; }
.col-right { border-left: 1px solid #2b3345; }
.col-center { background: #0a0d14; }

.block { background: #171c29; border: 1px solid #2b3345; border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.block form { display: grid; gap: 12px; }
.block label { display: grid; gap: 5px; color: #bdc8dd; font-size: 13px; }
.session-info { color: #aebbd0; font-size: 13px; overflow-wrap: anywhere; }

/* ---- 中栏：对话 ----------------------------------------------------------- */
.chat-empty { margin: auto; padding: 40px; color: #5e6e8d; text-align: center; font-size: 14px; }
#chat { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 10px; align-content: start; }
#chat:empty + .chat-empty { display: block; }
.run-status { min-height: 20px; margin: 0; padding: 0 20px 8px; color: #7c8dab; font-size: 13px; }
#chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px 20px; border-top: 1px solid #2b3345; background: #11151f; }

.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .bubble { background: #35569c; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: #1f2637; border: 1px solid #2b3345; border-bottom-left-radius: 4px; }
.msg.system .bubble { background: transparent; border: 1px dashed #4a3a3a; color: #e0a8a8; font-size: 13px; }
/* 技能触发占位符：中栏居中卡片，标注触发状态（客户端技能在调试控制台不执行）。 */
.msg.skill { justify-content: center; }
.skill-card { max-width: 88%; padding: 10px 14px; border-radius: 12px; background: #1c1830; border: 1px solid #4a4470; }
.skill-card .skill-title { margin: 0 0 4px; color: #c8bdf0; font-weight: 600; font-size: 13px; }
.skill-card .skill-note { margin: 0; color: #9a90c0; font-size: 12px; line-height: 1.45; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { background: #22314f; color: #cfe0ff; border: 1px solid #35569c; font-weight: 400; padding: 7px 12px; font-size: 14px; }

/* ---- 右栏：trace ---------------------------------------------------------- */
.trace-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.trace-head h2 { margin: 0; }
.trace-list { display: grid; gap: 8px; }
.trace-list:empty::before { content: '运行后这里显示 plan / tool / context 等中间事件。'; color: #5e6e8d; font-size: 13px; }
details.artifact { border: 1px solid #2b3345; border-radius: 10px; padding: 8px 12px; background: #131826; }
details.artifact summary { cursor: pointer; color: #8fa9d8; font-size: 13px; }
details.artifact pre { margin: 10px 0 2px; font-size: 12px; max-height: 360px; overflow: auto; white-space: pre-wrap; color: #d3e2ff; }
details.artifact .artifact-hint { margin: 8px 0 2px; padding: 7px 10px; font-size: 12px; line-height: 1.45; color: #c8b68a; background: #2a2417; border: 1px solid #4a3f22; border-radius: 6px; }

.advanced { margin-top: 18px; border-top: 1px solid #2b3345; padding-top: 14px; }
.advanced summary { cursor: pointer; color: #8fa9d8; font-size: 13px; margin-bottom: 12px; }
.advanced form { display: grid; gap: 10px; }
.advanced label { display: grid; gap: 5px; color: #bdc8dd; font-size: 13px; }
.raw-toggle { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 12px 0 6px; font-size: 13px; color: #bdc8dd; }
.raw-toggle input { width: auto; }
#events { max-height: 300px; overflow: auto; white-space: pre-wrap; color: #d3e2ff; font-size: 12px; }

/* ---- 窄屏降级（debug 工具桌面优先，窄屏简单堆叠） -------------------------- */
@media (max-width: 1000px) {
  .app { height: auto; min-height: 100vh; }
  .grid { grid-template-columns: 1fr; }
  .col-left, .col-right { border: 0; border-top: 1px solid #2b3345; }
  .col-center { min-height: 60vh; }
}
