:root { font-family: system-ui, "Microsoft YaHei", sans-serif; color: #232b30; background: #f5f7f6; }
* { box-sizing: border-box; }
body { margin: 0; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); height: 100dvh; }
.workspace { display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid #dce2e1; }
.topbar { display: flex; align-items: center; gap: 14px; min-height: 56px; border-bottom: 1px solid #e1e6e4; padding: 0 18px; }
.topbar a { text-decoration: none; color: #23746b; font-size: 23px; }
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
#phase { color: #5a686a; font-size: 13px; }
.conversation { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.message { max-width: 90%; padding: 11px 14px; background: #f1f5f3; border: 1px solid #e0e7e3; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14px; }
.message.user { align-self: flex-end; background: #e2f2ed; border-color: #d2e8de; }
.composer { border-top: 1px solid #dce2e1; padding: 12px 18px 16px; }
.identity { display: flex; gap: 10px; margin-bottom: 10px; }
.identity label { flex: 1; min-width: 0; font-size: 12px; color: #566462; }
input, textarea, select { padding: 8px 10px; border: 1px solid #bfcac6; border-radius: 4px; font: inherit; color: inherit; }
.identity input { display: block; margin-top: 4px; width: 100%; }
#query { width: 100%; resize: vertical; min-height: 68px; }
.actions { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; }
.actions-right { display: flex; gap: 8px; }
.mode { font-size: 14px; }
button { border: 1px solid #aac5bd; background: #fff; color: #1d645c; padding: 7px 12px; border-radius: 4px; font: inherit; cursor: pointer; }
button:hover { background: #eef7f3; }
button:disabled { opacity: .5; cursor: not-allowed; }
#send, .questions button[type=submit] { background: #216e63; color: #fff; border-color: #216e63; }
#error { color: #ae403b; min-height: 18px; font-size: 13px; padding-top: 4px; }

.monitor { overflow-y: auto; padding: 0 16px 20px; background: #fafbfb; }
.monitor-head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; min-height: 56px; background: #fafbfb; border-bottom: 1px solid #e1e6e4; }
.monitor-head h2 { font-size: 16px; margin: 0; flex: 1; }
.auto { font-size: 12px; color: #566462; }
.ids { font-size: 12px; color: #5a686a; padding: 10px 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline li { display: grid; gap: 2px; padding: 8px 10px 8px 14px; border-left: 4px solid #c9d2cf; background: #fff; border-radius: 3px; font-size: 13px; }
.timeline li span { color: #4c5a5c; overflow-wrap: anywhere; }
.timeline li.ok { border-left-color: #2f8f68; }
.timeline li.bad { border-left-color: #c0463f; }
.panel { margin-top: 10px; background: #fff; border: 1px solid #e1e6e4; border-radius: 4px; padding: 6px 10px; }
.panel summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 0; }
.panel pre { max-height: 360px; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.panel table { width: 100%; border-collapse: collapse; font-size: 12px; }
.panel th, .panel td { text-align: left; border-bottom: 1px solid #eef1f0; padding: 4px; vertical-align: top; overflow-wrap: anywhere; }

.modal { position: fixed; inset: 0; background: rgba(20, 30, 28, .45); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.modal-box { width: min(760px, 94vw); max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #e1e6e4; }
.modal-head h2 { margin: 0; font-size: 16px; flex: 1; }
#modal-status { font-size: 12px; color: #5a686a; }
#modal-close { font-size: 18px; line-height: 1; padding: 4px 10px; }
.modal-body { overflow-y: auto; padding: 14px 16px; flex: 1; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #e1e6e4; font-size: 13px; color: #5a686a; }
.questions { display: grid; gap: 12px; }
.question { display: grid; gap: 6px; }
.question > label { font-weight: 600; font-size: 14px; display: grid; gap: 2px; }
.question small { font-weight: 400; color: #6a7779; }
.question input, .question select, .question textarea { width: 100%; }
.question .skip { font-size: 12px; color: #6a7779; font-weight: 400; }

@media (max-width: 960px) {
    .layout { grid-template-columns: 1fr; height: auto; }
    .workspace { height: 80dvh; }
}
