* { box-sizing: border-box; }

:root { --page-max: 1320px; }

body {
  margin: 0 auto;
  max-width: 1380px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f3cf;
  color: #3f3f56;
  padding: 18px;
}

.dot { position: fixed; border-radius: 50%; opacity: .25; z-index: 0; pointer-events: none; }
.dot1 { width: 90px; height: 90px; background: #ffb8c6; left: 22px; top: 52px; }
.dot2 { width: 100px; height: 100px; background: #cdb4ff; left: 220px; bottom: 80px; }
.dot3 { width: 90px; height: 90px; background: #a0d8ff; right: 160px; top: 280px; }

.topbar, .grid-main, .card { position: relative; z-index: 1; }

/* 头部与内容同宽 */
body > .topbar {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
}
.grid-main {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
}

.btn { border: none; border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.btn.icon {
  background: #e8ddff; color: #7959df;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
}
.btn.icon svg { width: 18px; height: 18px; fill: currentColor; }
.btn.gray { background: #ececf0; color: #666; }
.btn.orange { background: linear-gradient(90deg, #ff8b2c, #ff5db1); color: #fff; }
.btn.purple { background: linear-gradient(90deg, #d044c0, #7a53f2); color: #fff; }
.btn.cyan { background: #14b8b0; color: #fff; }
.btn.danger { background: linear-gradient(90deg, #ff6a70, #e04357); color: #fff; }

.grid-main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
}

.card {
  background: linear-gradient(135deg, #f7e9f2, #edf6ef);
  border: 1px solid #efdce9;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .05);
}

.title-row h2 { margin: 0; color: #6a55ff; font-size: 30px; line-height: 1; }
.hint { margin-top: 8px; font-size: 12px; color: #6a6f86; }

.label { display: block; margin: 10px 0 6px; font-weight: 600; color: #666b82; }

.input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid #d8d8de;
  background: #fff;
  color: #3f3f56;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #c767ef;
  box-shadow: 0 0 0 3px rgba(199, 103, 239, 0.14);
}
.textarea { min-height: 94px; resize: vertical; }

.row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.action-row .btn { height: 38px; padding: 0 12px; }

.status-wrap {
  margin-top: 12px;
  background: rgba(255, 255, 255, .42);
  border: 1px solid #ecddee;
  border-radius: 12px;
  padding: 10px 12px;
}
.status-wrap h3 { margin: 0 0 6px; font-size: 15px; color: #7a5bd8; }
.status {
  color: #666c87;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

.right-panel { display: flex; flex-direction: column; min-height: 640px; }

.result { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.result-head { margin-bottom: 10px; }
.result h2 { margin: 0; color: #c950ea; }

.chat-list {
  flex: 1;
  min-height: 360px;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, .55);
  border: 1px solid #ecddee;
  border-radius: 14px;
  padding: 12px;
}
.empty { color: #7a7792; font-size: 13px; }

.msg { margin-bottom: 12px; display: flex; gap: 10px; }
.msg-role {
  width: 72px;
  flex-shrink: 0;
  color: #6e6a84;
  font-size: 12px;
  padding-top: 4px;
  font-weight: 600;
}
.msg-body { flex: 1; }
.msg-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.model-tag {
  font-size: 12px;
  color: #7d58d3;
  background: #f0e8ff;
  border: 1px solid #d9c9f5;
  border-radius: 999px;
  padding: 2px 8px;
}
.copy-btn {
  font-size: 12px;
  border: 1px solid #d8cbee;
  background: #f7f2ff;
  color: #5f5189;
  border-radius: 8px;
  padding: 2px 8px;
  cursor: pointer;
}
.copy-btn:hover { background: #efe7ff; }

.msg-content {
  background: #ffffff;
  border: 1px solid #ddd1ee;
  border-radius: 12px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}
.msg.user .msg-content { border-color: #c9d6ff; background: #f5f8ff; }
.msg.assistant .msg-content { border-color: #e6d2f3; background: #fff9ff; }
.msg.system .msg-content { border-color: #dcd9ef; background: #f5f5fb; }

.composer {
  margin-top: 12px;
  background: rgba(255, 255, 255, .45);
  border: 1px solid #ecddee;
  border-radius: 14px;
  padding: 12px;
}
.composer.dragover {
  border-color: #b17de8;
  box-shadow: 0 0 0 3px rgba(177, 125, 232, .18);
}
.composer-input { min-height: 90px; resize: vertical; }

.attach-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.attach-item {
  position: relative;
  width: 92px;
  height: 92px;
  border: 1px solid #dfd4ee;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: rgba(24, 24, 24, .72);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}
.attach-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #6e7287;
}

.composer-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.composer-actions .btn { height: 38px; padding: 0 14px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  display: grid;
  place-items: center;
  z-index: 310;
}
.hidden { display: none !important; }
.panel {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  z-index: 370;
}
.panel h3 { margin: 0 0 10px; color: #5e45b2; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.test-msg { margin: 8px 0 0; font-size: 14px; color: #333; }

@media (max-width: 980px) {
  .grid-main { grid-template-columns: 1fr; }
  .right-panel { min-height: 560px; }
  .chat-list { max-height: none; min-height: 320px; }
}

@media (max-width: 768px) {
  body { padding: 12px; }
  .card { padding: 14px; }
  .row.two-col, .action-row { grid-template-columns: 1fr; }
}
/* 可追加 */
.composer-actions .btn:disabled { opacity: .55; cursor: not-allowed; }