:root {
  color: #202a25;
  background: #f4f3ee;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; margin: 0; }
button, input, textarea { font: inherit; }
button { border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; background: #125e4c; color: #fff; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
button:hover { background: #0b4b3b; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .attachment-control:focus-within { outline: 3px solid #b9d8ce; outline-offset: 2px; }
.quiet-button, .secondary-button, .text-button { background: transparent; color: #205b4d; border-color: #cbd8d2; }
.quiet-button:hover, .secondary-button:hover, .text-button:hover { background: #edf5f1; color: #0d493b; border-color: #9bbcae; }
.text-button { padding: 5px 0; border: 0; border-radius: 0; font-size: 13px; font-weight: 600; text-align: left; }
.eyebrow { margin: 0; color: #68736c; font-size: 12px; font-weight: 600; letter-spacing: .07em; }
.form-status { min-height: 19px; margin: 0; color: #a04939; font-size: 13px; line-height: 1.45; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eeeee9; }
.login-card { width: min(420px, 100%); display: grid; gap: 15px; padding: 36px; background: #fff; border: 1px solid #e3e5df; border-radius: 18px; box-shadow: 0 18px 45px rgba(31, 42, 37, .08); }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.login-intro { margin: -3px 0 8px; color: #657069; font-size: 14px; line-height: 1.7; }
.login-card label { display: grid; gap: 7px; color: #39433e; font-size: 14px; font-weight: 600; }
.login-card input, .message-form textarea { width: 100%; border: 1px solid #d3d8d2; border-radius: 8px; padding: 11px 12px; background: #fff; color: #202a25; }
.login-card input:focus, .message-form textarea:focus { border-color: #6aa692; outline: none; }

.workspace { min-height: 100vh; }
.topbar { height: 62px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 28px; background: #fff; border-bottom: 1px solid #dedfd9; }
.brand-lockup { display: flex; align-items: baseline; gap: 12px; }
.topbar h1 { margin: 0; color: #1d2822; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.owner { display: flex; align-items: center; gap: 10px; color: #39433e; font-size: 14px; }
.owner-caption { color: #7b837e; font-size: 12px; }
.owner .quiet-button { padding: 6px 10px; }

.workbench { display: grid; grid-template-columns: 252px minmax(0, 1fr) 316px; min-height: calc(100vh - 62px); }
.workspace-sidebar { display: flex; flex-direction: column; min-height: 0; padding: 24px 14px 18px; background: #f8f8f5; border-right: 1px solid #dedfd9; }
.workspace-title { display: flex; justify-content: space-between; align-items: center; padding: 0 10px 13px; color: #77817b; font-size: 12px; }
#conversation-list { display: grid; gap: 4px; }
.conversation { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 13px 12px; background: transparent; color: #28322d; border: 1px solid transparent; border-radius: 9px; text-align: left; }
.conversation:hover { background: #eff2ed; }
.conversation.active { background: #115d4b; color: #fff; box-shadow: 0 6px 18px rgba(18, 94, 76, .15); }
.conversation strong { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.conversation span { color: #6e7772; font-size: 12px; }
.conversation small { overflow: hidden; color: #89918c; font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.conversation.active span, .conversation.active small { color: #d9eee6; }
.conversation-status { color: #a95d1b !important; font-weight: 700; }
.conversation-ready, .conversation-failed { border-color: #e3c59e; background: #fff8ed; }
.conversation-ready .conversation-status { color: #9a4e0b !important; }
.conversation-failed .conversation-status { color: #a13a35 !important; }
.conversation.active .conversation-status { color: #d9eee6 !important; }
.sidebar-note { margin: auto 10px 0; padding-top: 18px; color: #7a837d; border-top: 1px solid #dedfd9; font-size: 12px; line-height: 1.7; }

.chat-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; min-width: 0; min-height: 0; padding: 0 30px 18px; background: #fff; }
.chat-heading { display: flex; justify-content: space-between; gap: 22px; padding: 25px 0 18px; border-bottom: 1px solid #e6e7e2; }
.chat-heading h2 { margin: 5px 0 4px; color: #1d2822; font-size: 22px; letter-spacing: -.03em; }
.chat-heading p:not(.eyebrow) { margin: 0; color: #69736c; font-size: 13px; line-height: 1.55; }
.confirmation-boundary { align-self: flex-start; max-width: 205px; margin-top: 4px !important; color: #597269 !important; font-size: 12px !important; text-align: right; }
.messages { min-height: 280px; overflow-y: auto; padding: 20px 1px; }
.message { width: min(82%, 690px); margin-bottom: 19px; }
.message.owner { margin-left: auto; }
.message-meta { display: flex; align-items: baseline; gap: 9px; margin-bottom: 6px; color: #68736c; }
.message.owner .message-meta { justify-content: flex-end; }
.message-meta strong { color: #26322c; font-size: 13px; }
.message-meta time { color: #949b96; font-size: 12px; }
.message p { margin: 0; padding: 12px 14px; background: #f4f5f1; border-radius: 4px 12px 12px 12px; color: #29332e; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.message.owner p { background: #e5f1eb; border-radius: 12px 4px 12px 12px; }
.conversation-empty { width: min(590px, 100%); margin: 44px auto; padding: 24px 0; color: #657069; border-top: 1px solid #e2e5df; border-bottom: 1px solid #e2e5df; text-align: center; }
.conversation-empty h3 { margin: 0 0 9px; color: #2e3a34; font-size: 16px; }
.conversation-empty p { margin: 0 auto; max-width: 410px; font-size: 13px; line-height: 1.8; }

.upload-form { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 0; border-top: 1px solid #e6e7e2; }
.upload-form input[type="file"] { width: 1px; height: 1px; position: absolute; overflow: hidden; opacity: 0; }
.attachment-control { color: #275e50; font-size: 13px; font-weight: 600; cursor: pointer; }
.upload-form .quiet-button { padding: 5px 10px; font-size: 12px; }
.upload-form .form-status { flex: 1; min-width: 0; overflow: hidden; color: #63746a; text-overflow: ellipsis; white-space: nowrap; }
.message-form { display: grid; gap: 10px; padding-top: 8px; }
.message-form textarea { min-height: 78px; resize: vertical; line-height: 1.6; }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; }
.composer-actions button { min-width: 86px; }
.chat-panel > .form-status { color: #63746a; }

.context-panel { min-width: 0; overflow-y: auto; padding: 25px 20px; background: #f8f8f5; border-left: 1px solid #dedfd9; }
.context-heading { padding-bottom: 17px; border-bottom: 1px solid #dedfd9; }
.context-heading h2 { margin: 6px 0 0; color: #26312b; font-size: 17px; letter-spacing: -.02em; }
.context-section { padding: 18px 0; border-bottom: 1px solid #dedfd9; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-heading h3, .collaboration-rule h3 { margin: 0; color: #344039; font-size: 13px; }
.section-heading span { color: #7b857e; font-size: 11px; }
.codex-job-form { display: grid; gap: 8px; margin-bottom: 10px; }
.codex-job-form label { display: grid; gap: 4px; color: #68736c; font-size: 12px; }
.codex-job-form select, .codex-job-form textarea { width: 100%; border: 1px solid #d3d8d2; border-radius: 8px; padding: 8px 9px; background: #fff; color: #202a25; }
.codex-job-form textarea { min-height: 68px; resize: vertical; line-height: 1.55; }
#codex-job-list { display: grid; gap: 9px; }
#dashboard-tasks, #dashboard-risks, #brief-panel, #attachment-list { display: grid; gap: 9px; }
.context-item { padding: 11px 0 2px; }
.context-item + .context-item { border-top: 1px solid #e5e7e1; }
.context-label { margin: 0 0 5px; color: #2b705c; font-size: 11px; font-weight: 700; }
.context-item h4 { margin: 0; color: #2d3932; font-size: 13px; line-height: 1.55; }
.context-detail, .context-evidence { margin: 6px 0 0; color: #6d7771; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.context-evidence { color: #818983; }
.context-item .text-button { margin-top: 7px; }
.context-empty { margin: 0; color: #7a837d; font-size: 12px; line-height: 1.7; }
.collaboration-rule { padding-top: 18px; }
.collaboration-rule p { margin: 8px 0 0; color: #6b756f; font-size: 12px; line-height: 1.75; }

@media (max-width: 1040px) {
  .workbench { grid-template-columns: 218px minmax(0, 1fr) 270px; }
  .chat-panel { padding-right: 22px; padding-left: 22px; }
  .context-panel { padding-right: 16px; padding-left: 16px; }
}

@media (max-width: 800px) {
  .topbar { height: auto; align-items: flex-start; padding: 16px; }
  .brand-lockup { display: grid; gap: 3px; }
  .owner-caption { display: none; }
  .workbench { grid-template-columns: 1fr; min-height: 0; }
  .workspace-sidebar, .context-panel { border: 0; }
  .workspace-sidebar { min-height: auto; padding: 18px 14px; border-bottom: 1px solid #dedfd9; }
  #conversation-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-note { display: none; }
  .conversation { min-width: 0; }
  .chat-panel { min-height: 610px; padding: 0 16px 16px; }
  .chat-heading { display: grid; gap: 8px; }
  .confirmation-boundary { max-width: none; text-align: left; }
  .context-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 20px 16px; border-top: 1px solid #dedfd9; }
  .context-heading, .collaboration-rule { grid-column: 1 / -1; }
  .context-section { min-width: 0; }
  .upload-form, .composer-actions { align-items: stretch; flex-wrap: wrap; }
  .composer-actions { justify-content: stretch; }
  .composer-actions button { flex: 1; }
}

@media (max-width: 520px) {
  .topbar { gap: 12px; }
  .topbar h1 { font-size: 15px; }
  #conversation-list, .context-panel { grid-template-columns: 1fr; }
  .conversation small { display: none; }
  .context-heading, .collaboration-rule { grid-column: auto; }
  .message { width: 94%; }
}
