:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f3ef;
  --ink: #202624;
  --muted: #66716c;
  --line: #d9dfd8;
  --accent: #19725b;
  --accent-strong: #0f5d49;
  --accent-soft: #e1f1eb;
  --warn: #946400;
  --warn-soft: #fff1cd;
  --danger: #9a3f3f;
  --danger-soft: #f7e5e5;
  --chat: #f4f6fa;
  --shadow: 0 16px 40px rgba(34, 43, 38, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #b8c4bd;
  background: #fafbf9;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.connection {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 94px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.source-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.top-actions button,
.source-actions button,
.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.top-actions button:hover,
.source-actions button:hover,
.logout-link:hover {
  border-color: #b8c4bd;
  background: #fafbf9;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9aa39f;
}

.status-dot.online {
  background: var(--accent);
}

.status-dot.connecting {
  background: var(--warn);
}

.status-dot.offline,
.status-dot.error {
  background: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 18px;
  min-height: 0;
  padding: 18px;
}

.chat-panel,
.debug-panel {
  min-height: 0;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.empty-state {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  color: var(--muted);
}

.empty-title {
  font-size: 15px;
}

.empty-line {
  width: 88px;
  height: 2px;
  margin-top: 10px;
  border-radius: 99px;
  background: var(--line);
}

.message {
  display: grid;
  gap: 6px;
  max-width: min(760px, 88%);
}

.message.user {
  align-self: end;
}

.message.assistant,
.message.system {
  align-self: start;
}

.bubble {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat);
}

.message.user .bubble {
  border-color: #b6d5ca;
  background: var(--accent-soft);
}

.message.reject .bubble {
  border-color: #d6d6d2;
  background: #eeeeeb;
  color: #4e5652;
}

.message.skill .bubble {
  background: #fffdfa;
  border-color: #e2d5bb;
}

.bubble-text {
  padding: 11px 13px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 15px;
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
}

.message.user .message-meta {
  text-align: right;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  padding: 13px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.composer textarea {
  min-height: 44px;
  max-height: 138px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.45;
  outline: none;
}

.composer textarea:focus,
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 114, 91, 0.13);
}

#sendButton {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

#sendButton:hover {
  background: var(--accent-strong);
}

.debug-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.control-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.panel-title {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: #3a423f;
  font-size: 13px;
  font-weight: 700;
}

.control-panel .panel-title {
  margin: -14px -14px 0;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.toggle {
  color: var(--muted);
  font-size: 13px;
}

.field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  outline: none;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.debug-list {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.debug-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  font-size: 14px;
}

.debug-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
}

.debug-item + .debug-item {
  margin-top: 10px;
}

.debug-item summary {
  display: grid;
  gap: 8px;
  padding: 11px;
  cursor: pointer;
  list-style: none;
}

.debug-item summary::-webkit-details-marker {
  display: none;
}

.debug-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.debug-title span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-body {
  display: grid;
  gap: 12px;
  padding: 0 11px 11px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #46504b;
  font-size: 12px;
  word-break: break-word;
}

.chip.chat {
  border-color: #c4d4e4;
  background: #eaf2f8;
}

.chip.reject {
  border-color: #d3d3d0;
  background: #eeeeeb;
}

.chip.skill {
  border-color: #dfd0a9;
  background: var(--warn-soft);
}

.kv {
  display: grid;
  gap: 7px;
}

.kv-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  font-size: 13px;
}

.kv-key {
  color: var(--muted);
}

.kv-value {
  min-width: 0;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

.skill-card {
  display: grid;
  gap: 10px;
  padding: 0 13px 13px;
}

.skill-section {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.skill-section:first-child {
  border-top: 0;
}

.skill-heading {
  color: #48524d;
  font-size: 13px;
  font-weight: 700;
}

.table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.table-row {
  display: grid;
  grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
}

.table-row + .table-row {
  border-top: 1px solid var(--line);
}

.table-key,
.table-value {
  min-width: 0;
  padding: 8px 9px;
  font-size: 13px;
  word-break: break-word;
  white-space: pre-wrap;
}

.table-key {
  background: #f7f8f5;
  color: var(--muted);
}

.table-value {
  border-left: 1px solid var(--line);
  color: var(--ink);
}

.raw {
  border-top: 1px solid var(--line);
}

.raw summary {
  padding: 8px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.raw pre {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111816;
  color: #dce7df;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.pipeline {
  display: grid;
  gap: 6px;
  margin: 11px 13px 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.pipeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pipeline-title {
  color: #48524d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pipeline-sub {
  color: var(--muted);
  font-size: 11px;
}

.pl-row {
  display: grid;
  grid-template-columns: 88px minmax(48px, 1fr) minmax(0, auto) 50px;
  align-items: center;
  gap: 9px;
}

.pl-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebe5;
}

.pl-bar {
  display: block;
  width: 6%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.35s ease;
}

.pl-row.pending .pl-bar {
  width: 32%;
  background: repeating-linear-gradient(90deg, #cfd8d2 0 8px, #e7ebe5 8px 16px);
  animation: pl-pulse 0.9s linear infinite;
}

@keyframes pl-pulse {
  to {
    background-position: 16px 0;
  }
}

.pl-row.error .pl-bar {
  width: 100%;
  background: var(--danger);
}

/* 并发跑了但结果未被最终路由采纳的阶段 */
.pl-row.unused {
  opacity: 0.45;
}

.pl-row.unused .pl-name {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.pl-row.unused .pl-bar,
.pl-row.unused.pending .pl-bar {
  background: #c9d0cb;
  animation: none;
}

/* “未采纳”标记放在 detail 列尾，避免 88px 的 name 列裁切 */
.pl-row.unused .pl-detail {
  overflow: visible;
}

.pl-row.unused .pl-detail::after {
  content: "未采纳";
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #eeeeeb;
  color: #5b635e;
  font-size: 10px;
}

.pl-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-cost {
  color: #48524d;
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pipeline-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.pl-route {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.pl-route.skill {
  border-color: #dfd0a9;
  background: var(--warn-soft);
  color: #7a5400;
}

.pl-route.chat {
  border-color: #c4d4e4;
  background: #eaf2f8;
  color: #2b5577;
}

.pl-route.reject {
  border-color: #d3d3d0;
  background: #eeeeeb;
  color: #5b635e;
}

.pl-note {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 多轮改写对比条 */
.rewrite-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 11px 13px 0;
  padding: 8px 11px;
  border: 1px solid #dfd0a9;
  border-radius: 8px;
  background: var(--warn-soft);
  font-size: 12px;
}

.rw-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: #7a5400;
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.rw-from {
  color: #8a7340;
  text-decoration: line-through;
  text-decoration-color: #b39a5e;
}

.rw-arrow {
  color: #7a5400;
  font-weight: 700;
}

.rw-to {
  color: #5c4000;
  font-weight: 650;
}

/* 动态 FC 收敛：TopK 意图召回 + LLM 精排选中 */
.fc-recall {
  display: grid;
  gap: 5px;
  margin-top: 3px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.fc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.fc-title {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fc-sub {
  color: var(--muted);
  font-size: 11px;
}

.fc-cand {
  display: grid;
  grid-template-columns: minmax(64px, 96px) minmax(40px, 1fr) 42px minmax(0, auto);
  align-items: center;
  gap: 8px;
}

.fc-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebe5;
}

.fc-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #a9c4ba;
  transition: width 0.35s ease;
}

.fc-cand.chosen .fc-bar {
  background: var(--accent);
}

.fc-cand.chosen .fc-name {
  font-weight: 700;
}

.fc-score {
  color: #48524d;
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fc-flag {
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* 预置话术 */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 13px 0;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.preset-tag {
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

.preset-tag.skill {
  background: var(--warn-soft);
  color: #7a5400;
}

.preset-tag.rewrite {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.preset-tag.chat {
  background: #eaf2f8;
  color: #2b5577;
}

.preset-tag.reject {
  background: #eeeeeb;
  color: #5b635e;
}

.preset-rotate {
  border-style: dashed;
  color: var(--muted);
}

/* 预置话术与输入框同属底部操作区，去掉中间多余分隔线 */
.presets + .composer {
  border-top: none;
  padding-top: 10px;
}

/* 架构面板：配色取自架构介绍 PPT（藏青 1F4E79 / 块蓝 2E75B6 / 箭头橙 ED7D31） */
.arch-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 25, 22, 0.54);
}

.arch-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1080px, 100%);
  max-height: 92vh;
  overflow: hidden;
  border-radius: 12px;
  background: #f7fafc;
  box-shadow: var(--shadow);
}

.arch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #1f4e79;
  color: #fff;
}

.arch-kicker {
  color: #9db8d2;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.arch-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.arch-header button {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
}

.arch-header button:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.arch-body {
  overflow-y: auto;
  padding: 14px 20px 20px;
}

.arch-subtitle {
  margin: 2px 0 12px;
  color: #666666;
  font-size: 13px;
  font-style: italic;
  text-align: center;
}

.arch-diagram {
  overflow-x: auto;
  padding: 6px 2px;
  border: 1px solid #dde6ef;
  border-radius: 10px;
  background: #fff;
}

.arch-diagram svg {
  display: block;
  min-width: 900px;
  width: 100%;
  height: auto;
  font-family: inherit;
}

.ab-box {
  fill: #2e75b6;
  filter: drop-shadow(0 2px 3px rgba(31, 78, 121, 0.28));
}

.ab-pool {
  fill: #e8eef7;
  stroke: #a6b9d6;
  stroke-width: 1.5;
}

.ab-pool-title {
  fill: #1f4e79;
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
}

.ab-diamond {
  fill: #ed7d31;
  filter: drop-shadow(0 2px 3px rgba(237, 125, 49, 0.35));
}

.ab-text,
.ab-text-bold {
  fill: #fff;
  font-size: 13px;
  font-weight: 650;
  text-anchor: middle;
}

.ab-text-bold {
  font-size: 14px;
  font-weight: 750;
}

.ab-caption {
  fill: #666666;
  font-size: 11px;
  text-anchor: middle;
}

.ab-label-bg {
  fill: #fff;
  stroke: #dde6ef;
}

.ab-label {
  fill: #1f4e79;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
}

.ab-arrow {
  stroke: #ed7d31;
  stroke-width: 3.5;
  marker-end: url(#arrowOrange);
}

.arch-section-title {
  margin: 20px 0 10px;
  color: #1f4e79;
  font-size: 15px;
  text-align: center;
}

.arch-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.arch-card {
  overflow: hidden;
  border: 1px solid #dde6ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(31, 78, 121, 0.1);
}

.arch-card-head {
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.arch-card-body {
  padding: 10px 12px 12px;
  color: #333333;
  font-size: 12.5px;
  line-height: 1.6;
}

@media (max-width: 960px) {
  .arch-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .arch-cards {
    grid-template-columns: 1fr;
  }
}

.source-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 25, 22, 0.54);
}

.source-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(820px, 94vh);
  overflow: hidden;
  border: 1px solid #dfe5de;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(12, 18, 15, 0.28);
}

.source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.source-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.source-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: 0;
}

.source-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
}

.source-sidebar {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f8faf7;
}

.source-files {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.source-file {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 48px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.source-file:hover {
  background: var(--surface);
}

.source-file.active {
  border-color: #bad7cc;
  background: var(--accent-soft);
}

.source-file-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.source-file-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-code-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #101615;
}

.source-meta {
  min-height: 36px;
  padding: 10px 12px;
  border-bottom: 1px solid #26302d;
  background: #151d1a;
  color: #aebbb5;
  font-size: 12px;
}

.source-code {
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 10px 0;
  color: #e7eee9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.code-line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 20px;
}

.code-line:hover {
  background: #18211e;
}

.line-no {
  padding: 0 12px 0 8px;
  color: #66756f;
  text-align: right;
  user-select: none;
}

.line-src {
  min-width: 0;
  padding-right: 14px;
  white-space: pre;
}

.login-page {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--bg);
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand h1 {
  font-size: 18px;
}

.login-form {
  display: grid;
  gap: 13px;
}

.login-form button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.login-error {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #dfb8b8;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(480px, 62vh) minmax(360px, 1fr);
  }

  .debug-panel {
    min-height: 360px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 13px;
  }

  .connection {
    align-self: start;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .workspace {
    gap: 12px;
    padding: 12px;
  }

  .message {
    max-width: 100%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  #sendButton {
    width: 100%;
  }

  .source-modal {
    padding: 8px;
  }

  .source-shell {
    height: 96vh;
  }

  .source-header {
    align-items: stretch;
    flex-direction: column;
  }

  .source-body {
    grid-template-columns: 1fr;
    grid-template-rows: 190px minmax(0, 1fr);
  }

  .source-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
