.desktop-cockpit .qa-assistant-page {
  display: flex;
  width: 100%;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  min-width: 0;
  min-height: 620px;
  max-width: none;
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px);
  box-sizing: border-box;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(10, 61, 98, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(42, 78, 105, 0.1);
  color: #183349;
}

.desktop-cockpit .qa-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(10, 61, 98, 0.1);
  background: rgba(248, 252, 254, 0.86);
}

.desktop-cockpit .qa-page-head > div {
  min-width: 0;
}

.desktop-cockpit .qa-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 7px;
}

.desktop-cockpit .qa-page-kicker {
  display: block;
  margin-bottom: 3px;
  color: #1687ad;
  font-size: 13px;
  font-weight: 700;
}

.desktop-cockpit .qa-page-head h2 {
  margin: 0;
  color: #102f46;
  font-size: 24px;
  line-height: 1.25;
}

.desktop-cockpit .qa-page-head p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 4px 0 0;
  color: #6b7f90;
  font-size: 14px;
}

.desktop-cockpit .qa-page-head p strong {
  color: #31536b;
}

.desktop-cockpit .qa-page-head p span::before {
  content: "·";
  margin-right: 12px;
  color: #9aabba;
}

.desktop-cockpit .qa-clear-button,
.desktop-cockpit .qa-inline-quick button,
.desktop-cockpit .qa-quick-grid button,
.desktop-cockpit .qa-message-meta button {
  border: 1px solid rgba(10, 61, 98, 0.13);
  background: #ffffff;
  color: #31536b;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.desktop-cockpit .qa-clear-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
}

.desktop-cockpit .qa-clear-button:hover,
.desktop-cockpit .qa-inline-quick button:hover,
.desktop-cockpit .qa-quick-grid button:hover,
.desktop-cockpit .qa-message-meta button:hover {
  border-color: rgba(0, 168, 216, 0.45);
  background: #eefaff;
  color: #087ca7;
}

.desktop-cockpit .qa-clear-button:disabled,
.desktop-cockpit .qa-inline-quick button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.desktop-cockpit .qa-rule-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 40, 57, 0.46);
}

.desktop-cockpit .qa-rule-dialog {
  display: flex;
  width: min(1040px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(10, 61, 98, 0.14);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(18, 47, 70, 0.25);
}

.desktop-cockpit .qa-rule-head,
.desktop-cockpit .qa-rule-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(10, 61, 98, 0.1);
  background: #f8fcfe;
}

.desktop-cockpit .qa-rule-head h3 {
  margin: 0;
  color: #102f46;
  font-size: 20px;
}

.desktop-cockpit .qa-rule-head p {
  margin: 3px 0 0;
  color: #6b7f90;
  font-size: 13px;
}

.desktop-cockpit .qa-rule-close,
.desktop-cockpit .qa-rule-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  color: #6b7f90;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.desktop-cockpit .qa-rule-close:hover,
.desktop-cockpit .qa-rule-remove:hover {
  color: #b42318;
  background: #fff4f2;
}

.desktop-cockpit .qa-rule-body {
  min-height: 180px;
  overflow: auto;
  padding: 14px 18px 8px;
}

.desktop-cockpit .qa-rule-table-wrap {
  min-width: 720px;
}

.desktop-cockpit .qa-rule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.desktop-cockpit .qa-rule-table th {
  padding: 8px;
  border-bottom: 1px solid rgba(10, 61, 98, 0.12);
  color: #6b7f90;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.desktop-cockpit .qa-rule-table th:nth-child(1) { width: 18%; }
.desktop-cockpit .qa-rule-table th:nth-child(2) { width: 16%; }
.desktop-cockpit .qa-rule-table th:nth-child(3) { width: 18%; }
.desktop-cockpit .qa-rule-table th:nth-child(4) { width: auto; }
.desktop-cockpit .qa-rule-table th:nth-child(5) { width: 42px; }

.desktop-cockpit .qa-rule-table td {
  padding: 5px 4px;
  border-bottom: 1px solid rgba(10, 61, 98, 0.07);
}

.desktop-cockpit .qa-rule-table input {
  width: 100%;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #263f51;
  background: transparent;
  font: inherit;
  font-size: 13px;
}

.desktop-cockpit .qa-rule-table input:hover { border-color: rgba(10, 61, 98, 0.16); }
.desktop-cockpit .qa-rule-table input:focus {
  outline: none;
  border-color: #00a8d8;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 168, 216, 0.1);
}

.desktop-cockpit .qa-rule-state,
.desktop-cockpit .qa-rule-empty {
  padding: 44px 12px;
  color: #6b7f90;
  text-align: center;
  font-size: 14px;
}

.desktop-cockpit .qa-rule-feedback {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.desktop-cockpit .qa-rule-feedback.is-error { color: #b42318; background: #fff4f2; }
.desktop-cockpit .qa-rule-feedback.is-success { color: #067647; background: #ecfdf3; }

.desktop-cockpit .qa-rule-foot {
  border-top: 1px solid rgba(10, 61, 98, 0.1);
  border-bottom: 0;
  background: #ffffff;
}

.desktop-cockpit .qa-rule-foot > div {
  display: flex;
  gap: 8px;
}

.desktop-cockpit .qa-rule-add,
.desktop-cockpit .qa-rule-cancel,
.desktop-cockpit .qa-rule-save {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.desktop-cockpit .qa-rule-add,
.desktop-cockpit .qa-rule-cancel {
  border: 1px solid rgba(10, 61, 98, 0.14);
  color: #31536b;
  background: #ffffff;
}

.desktop-cockpit .qa-rule-save {
  min-width: 72px;
  border: 1px solid #008ab5;
  color: #ffffff;
  background: #008ab5;
}

.desktop-cockpit .qa-rule-add:hover,
.desktop-cockpit .qa-rule-cancel:hover {
  border-color: #00a8d8;
  color: #087ca7;
}

.desktop-cockpit .qa-rule-save:hover { background: #00789f; }
.desktop-cockpit .qa-rule-add:disabled,
.desktop-cockpit .qa-rule-cancel:disabled,
.desktop-cockpit .qa-rule-save:disabled { cursor: not-allowed; opacity: 0.5; }

.desktop-cockpit .qa-rule-readonly {
  color: #7b8e9d;
  font-size: 12px;
}

@media (max-width: 720px) {
  .desktop-cockpit .qa-rule-backdrop { padding: 0; }
  .desktop-cockpit .qa-rule-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .desktop-cockpit .qa-rule-head,
  .desktop-cockpit .qa-rule-foot { padding-right: 12px; padding-left: 12px; }
  .desktop-cockpit .qa-rule-body { padding-right: 12px; padding-left: 12px; }
}

.desktop-cockpit .qa-chat-surface {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.desktop-cockpit .qa-conversation {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px clamp(16px, 2vw, 30px);
  scrollbar-color: rgba(62, 105, 133, 0.28) transparent;
  scrollbar-width: thin;
}

.desktop-cockpit .qa-welcome {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.desktop-cockpit .qa-welcome-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(145deg, #14b8d4, #2f72ff);
  box-shadow: 0 12px 26px rgba(31, 132, 188, 0.2);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.desktop-cockpit .qa-welcome h2 {
  margin: 0;
  color: #173b54;
  font-size: 21px;
}

.desktop-cockpit .qa-welcome > p {
  margin: 7px 0 16px;
  color: #6b7f90;
  font-size: 14px;
}

.desktop-cockpit .qa-quick-grid {
  display: grid;
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.desktop-cockpit .qa-quick-grid button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
}

.desktop-cockpit .qa-message-list {
  width: 100%;
  max-width: none;
  margin: 0;
}

.desktop-cockpit .qa-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.desktop-cockpit .qa-message.from-user {
  flex-direction: row-reverse;
}

.desktop-cockpit .qa-message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(145deg, #18b8cf, #3579ef);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.desktop-cockpit .qa-message.from-user .qa-message-avatar {
  background: #e8f2f7;
  color: #31536b;
}

.desktop-cockpit .qa-message-main {
  min-width: 0;
  max-width: calc(100% - 44px);
}

.desktop-cockpit .qa-message.from-user .qa-message-main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.desktop-cockpit .qa-message-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 21px;
  margin-bottom: 4px;
  color: #49677d;
  font-size: 13px;
}

.desktop-cockpit .qa-message-head time {
  color: #93a3af;
  font-size: 12px;
}

.desktop-cockpit .qa-message-bubble {
  padding: 9px 13px;
  border: 1px solid rgba(10, 61, 98, 0.11);
  border-radius: 4px 8px 8px 8px;
  background: #f7fafc;
  color: #263f51;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.desktop-cockpit .qa-message.from-user .qa-message-bubble {
  border-color: rgba(0, 168, 216, 0.16);
  border-radius: 8px 4px 8px 8px;
  background: #e9f8fd;
  color: #153b52;
}

.desktop-cockpit .qa-message.is-failed .qa-message-bubble {
  border-color: rgba(211, 68, 68, 0.18);
  background: #fff7f7;
}

.desktop-cockpit .qa-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 5px;
  color: #7b8e9d;
  font-size: 12px;
}

.desktop-cockpit .qa-message-meta span {
  overflow: hidden;
  max-width: 320px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-cockpit .qa-message-meta button {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 12px;
}

.desktop-cockpit .qa-message.is-thinking .qa-message-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 180px;
}

.desktop-cockpit .qa-message.is-thinking .qa-message-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #27a8cb;
  animation: qa-thinking 1.1s ease-in-out infinite;
}

.desktop-cockpit .qa-message.is-thinking .qa-message-bubble span:nth-child(2) {
  animation-delay: 0.14s;
}

.desktop-cockpit .qa-message.is-thinking .qa-message-bubble span:nth-child(3) {
  animation-delay: 0.28s;
}

.desktop-cockpit .qa-message.is-thinking .qa-message-bubble em {
  margin-left: 4px;
  color: #708493;
  font-size: 13px;
  font-style: normal;
}

.desktop-cockpit .qa-composer-wrap {
  flex: 0 0 auto;
  min-width: 0;
  padding: 8px clamp(16px, 2vw, 30px) 9px;
  border-top: 1px solid rgba(10, 61, 98, 0.1);
  background: rgba(250, 253, 254, 0.94);
}

.desktop-cockpit .qa-inline-quick,
.desktop-cockpit .qa-composer,
.desktop-cockpit .qa-composer-hint {
  width: 100%;
  max-width: none;
  margin-right: 0;
  margin-left: 0;
}

.desktop-cockpit .qa-inline-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 7px;
}

.desktop-cockpit .qa-inline-quick button {
  min-width: 0;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.desktop-cockpit .qa-composer {
  display: flex;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
  max-width: none;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(10, 61, 98, 0.17);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(42, 78, 105, 0.08);
}

.desktop-cockpit .qa-composer:focus-within {
  border-color: rgba(0, 168, 216, 0.58);
  box-shadow: 0 0 0 3px rgba(0, 168, 216, 0.08);
}

.desktop-cockpit .qa-quote-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
  padding: 7px 10px;
  border-left: 3px solid #4a7dff;
  border-radius: 4px;
  background: #eef2ff;
  font-size: 13px;
}

.desktop-cockpit .qa-quote-label {
  flex: 0 0 auto;
  color: #315fc4;
  font-weight: 700;
}

.desktop-cockpit .qa-quote-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: #52606d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-cockpit .qa-quote-close {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #718096;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.desktop-cockpit .qa-quote-close:hover {
  background: rgba(74, 125, 255, 0.1);
  color: #315fc4;
}

.desktop-cockpit .qa-composer textarea {
  min-width: 0;
  min-height: 40px;
  max-height: 108px;
  flex: 1 1 auto;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #183349;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
}

.desktop-cockpit .qa-composer textarea:focus {
  box-shadow: none;
}

.desktop-cockpit .qa-send-button,
.desktop-cockpit .qa-stop-button {
  min-width: 82px;
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0 15px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.desktop-cockpit .qa-send-button {
  background: linear-gradient(135deg, #09afd0, #3478ec);
}

.desktop-cockpit .qa-stop-button {
  background: #536b7d;
}

.desktop-cockpit .qa-send-button:hover,
.desktop-cockpit .qa-stop-button:hover {
  filter: brightness(0.96);
}

.desktop-cockpit .qa-composer-hint {
  margin-top: 3px;
  margin-bottom: 0;
  color: #8a9ba8;
  font-size: 12px;
  text-align: right;
}

@keyframes qa-thinking {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 900px) {
  .desktop-cockpit .qa-assistant-page {
    height: auto;
    min-height: 620px;
    max-height: none;
  }

  .desktop-cockpit .qa-conversation {
    max-height: none;
    padding: 14px 16px;
  }

  .desktop-cockpit .qa-composer-wrap {
    padding-right: 16px;
    padding-left: 16px;
  }

  .desktop-cockpit .qa-message-main {
    max-width: calc(100% - 44px);
  }

  .desktop-cockpit .qa-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .desktop-cockpit .qa-page-head {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .desktop-cockpit .qa-page-actions {
    flex-wrap: wrap;
  }

  .desktop-cockpit .qa-quick-grid {
    grid-template-columns: 1fr;
  }

  .desktop-cockpit .qa-inline-quick {
    grid-template-columns: 1fr;
  }

  .desktop-cockpit .qa-composer {
    align-items: stretch;
    flex-direction: column;
  }

  .desktop-cockpit .qa-send-button,
  .desktop-cockpit .qa-stop-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .desktop-cockpit .qa-message.is-thinking .qa-message-bubble span {
    animation: none;
  }
}

/* ── 多会话侧栏 + 检测单报告标签 ── */
.desktop-cockpit .qa-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.desktop-cockpit .qa-session-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 220px;
  min-width: 220px;
  border-right: 1px solid rgba(10, 61, 98, 0.1);
  background: rgba(240, 245, 250, 0.6);
  overflow: hidden;
}

.desktop-cockpit .qa-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #183349;
  border-bottom: 1px solid rgba(10, 61, 98, 0.1);
}

.desktop-cockpit .qa-session-new {
  border: none;
  background: none;
  color: #0a6db0;
  font-size: 13px;
  cursor: pointer;
}

.desktop-cockpit .qa-session-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
}

.desktop-cockpit .qa-session-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 9px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  color: #2c4a61;
  font-size: 13px;
}

.desktop-cockpit .qa-session-item:hover {
  background: rgba(10, 109, 176, 0.08);
}

.desktop-cockpit .qa-session-item.is-active {
  background: rgba(10, 109, 176, 0.14);
  color: #0a5d94;
  font-weight: 600;
}

.desktop-cockpit .qa-session-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-cockpit .qa-session-menu {
  position: fixed;
  z-index: 1200;
  min-width: 132px;
  padding: 5px;
  border: 1px solid rgba(10, 61, 98, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(18, 47, 70, 0.18);
}

.desktop-cockpit .qa-session-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #31536b;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.desktop-cockpit .qa-session-menu button:hover {
  background: #eefaff;
  color: #087ca7;
}

.desktop-cockpit .qa-session-menu button.is-danger:hover {
  background: #fff4f2;
  color: #b42318;
}

.desktop-cockpit .qa-session-empty {
  padding: 16px 10px;
  text-align: center;
  color: #7a93a6;
  font-size: 12px;
}

.desktop-cockpit .qa-message-report-tag {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: rgba(10, 109, 176, 0.1);
  color: #0a5d94;
  font-size: 12px;
}

@media (max-width: 720px) {
  .desktop-cockpit .qa-session-pane {
    display: none;
  }
}
