:root {
  --bg: #ededed;
  --panel: #f7f7f7;
  --line: #d9d9d9;
  --text: #222;
  --muted: #7a7a7a;
  --green: #95ec69;
  --green-dark: #68c446;
  --white: #fff;
  --wx-top: rgba(248,248,248,0.92);
  --shadow: 0 6px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(72, 188, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #f2f5f8 0%, #e9edf2 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden { display: none !important; }

.wx-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wx-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wx-top);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.wx-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wx-avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #40a9ff, #36cfc9);
  box-shadow: 0 0 10px rgba(54, 207, 201, 0.5);
}

.wx-title {
  font-size: 17px;
  font-weight: 700;
}

.wx-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.wx-top-btn {
  border: none;
  background: rgba(0,0,0,0.05);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.wx-main {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 14px 10px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wx-chat-box {
  flex: 1;
  min-height: 62vh;
  max-height: 68vh;
  overflow-y: auto;
  padding: 10px 6px 16px;
}

.msg-wrap {
  margin-bottom: 14px;
}

.msg {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 10px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.msg.user {
  margin-left: auto;
  background: var(--green);
}

.msg.assistant {
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.04);
}

.msg-tools {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.msg-tool-btn {
  border: none;
  background: rgba(0,0,0,0.04);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
}

.wx-image-preview {
  background: rgba(255,255,255,0.8);
  border-radius: 14px;
  padding: 10px;
  margin: 0 4px 10px;
  box-shadow: var(--shadow);
}

.wx-image-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.wx-image-preview-img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 10px;
}

.wx-mini-btn {
  border: none;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.wx-composer {
  background: rgba(250,250,250,0.96);
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 10px 8px 8px;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 18px rgba(0,0,0,0.05);
}

.wx-tool-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.wx-tool-btn,
.wx-ghost-btn,
.wx-primary-btn {
  border: none;
  cursor: pointer;
}

.wx-tool-btn {
  background: rgba(0,0,0,0.05);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.wx-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wx-expert-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.wx-expert-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: auto;
}

.wx-expert-slider {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0,0,0,0.12);
  position: relative;
}

.wx-expert-slider::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: all .2s ease;
}

.wx-expert-switch input:checked + .wx-expert-slider {
  background: var(--green-dark);
}

.wx-expert-switch input:checked + .wx-expert-slider::after {
  left: 19px;
}

.wx-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.wx-textarea {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  resize: vertical;
  border: none;
  outline: none;
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.wx-small-textarea {
  min-height: 80px;
  margin-top: 10px;
}

.wx-send-btn {
  background: linear-gradient(135deg, var(--green), #7dda56);
  color: #152200;
  border: none;
  width: 84px;
  height: 34px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  align-self: center;
  cursor: pointer;
}

.wx-primary-btn {
  background: linear-gradient(135deg, var(--green), #7dda56);
  color: #152200;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 700;
}

.wx-tip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.wx-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.36);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}

.wx-modal-panel {
  width: min(560px, calc(100vw - 24px));
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.2);
}

.wx-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.wx-option-list {
  display: grid;
  gap: 8px;
}

.option-chip {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #f7f7f7;
  cursor: pointer;
}

.option-chip.active {
  background: rgba(149,236,105,0.2);
  border-color: rgba(104,196,70,0.45);
}

.wx-resolution-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 14px;
}

.wx-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.wx-ghost-btn {
  background: rgba(0,0,0,0.05);
  padding: 10px 14px;
  border-radius: 10px;
}

.wx-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 120;
}

@media (max-width: 640px) {
  .wx-main {
    padding: 10px 6px 16px;
  }

  .wx-chat-box {
    min-height: 58vh;
    max-height: 62vh;
  }

  .wx-input-row {
    flex-direction: row;
    align-items: flex-end;
  }

  .msg {
    max-width: 90%;
  }

  .wx-tool-row {
    gap: 6px;
  }

  .wx-send-btn {
    width: 72px;
    height: 32px;
    font-size: 12px;
  }
}

.wx-tool-btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  color: #333;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.wx-tool-btn-text:hover {
  background: #f8f8f8;
}

.wx-file-btn {
  gap: 0;
}

.wx-tool-icon,
.wx-tool-icon-minimal,
.mic-icon,
.image-icon {
  display: none !important;
}

/* ===== Fix: AI使用与患者画像 - 全部提问与模型回答表格列宽 ===== */

/* 表格外层允许横向滚动，避免回答内容过长时挤压页面 */
.qa-table-wrap,
.all-qa-table-wrap,
.audit-table-wrap,
.usage-table-wrap,
.profile-table-wrap {
  width: 100%;
  overflow-x: auto;
}

/* 固定表格布局，避免“用户”列按内容无限撑宽 */
.qa-table,
.all-qa-table,
.audit-table,
.usage-table,
.profile-table,
table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

/* 单元格允许换行 */
.qa-table th,
.qa-table td,
.all-qa-table th,
.all-qa-table td,
.audit-table th,
.audit-table td,
.usage-table th,
.usage-table td,
.profile-table th,
.profile-table td,
table th,
table td {
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* 第1列：用户列，限制宽度 */
.qa-table th:nth-child(1),
.qa-table td:nth-child(1),
.all-qa-table th:nth-child(1),
.all-qa-table td:nth-child(1),
.audit-table th:nth-child(1),
.audit-table td:nth-child(1),
.usage-table th:nth-child(1),
.usage-table td:nth-child(1),
.profile-table th:nth-child(1),
.profile-table td:nth-child(1),
table th:nth-child(1),
table td:nth-child(1) {
  width: 120px;
  max-width: 120px;
}

/* 第2列：提问列 */
.qa-table th:nth-child(2),
.qa-table td:nth-child(2),
.all-qa-table th:nth-child(2),
.all-qa-table td:nth-child(2),
.audit-table th:nth-child(2),
.audit-table td:nth-child(2),
.usage-table th:nth-child(2),
.usage-table td:nth-child(2),
.profile-table th:nth-child(2),
.profile-table td:nth-child(2),
table th:nth-child(2),
table td:nth-child(2) {
  width: 28%;
}

/* 第3列：模型回答列，给最大空间 */
.qa-table th:nth-child(3),
.qa-table td:nth-child(3),
.all-qa-table th:nth-child(3),
.all-qa-table td:nth-child(3),
.audit-table th:nth-child(3),
.audit-table td:nth-child(3),
.usage-table th:nth-child(3),
.usage-table td:nth-child(3),
.profile-table th:nth-child(3),
.profile-table td:nth-child(3),
table th:nth-child(3),
table td:nth-child(3) {
  width: 46%;
}

/* 如果某列内容太长，限制最大显示高度，避免单条记录撑爆页面 */
.qa-table td,
.all-qa-table td,
.audit-table td,
.usage-table td,
.profile-table td {
  max-height: 240px;
}

