:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17202a;
  background: #edf1f2;
  letter-spacing: 0;
  --ink: #17202a;
  --muted: #637078;
  --line: #cfd7d9;
  --paper: #fff;
  --green: #18794e;
  --green-bg: #e9f7ef;
  --amber: #9a6700;
  --amber-bg: #fff6d8;
  --red: #b42318;
  --red-bg: #fff0ee;
  --blue: #1769aa;
  --blue-bg: #eaf4fb;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background: #edf1f2;
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: #111a1e;
  color: #fff;
  border-bottom: 3px solid #22a06b;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: #22a06b;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  border-radius: 4px;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-copy strong {
  font-size: 15px;
}
.brand-copy span {
  font-size: 9px;
  color: #9fb0b7;
  margin-top: 3px;
}
.top-status {
  margin-left: auto;
  font-size: 12px;
  color: #ccebdc;
  display: flex;
  align-items: center;
  gap: 7px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48c78e;
}
.back-link {
  color: #d9e1e4;
  text-decoration: none;
  font-size: 12px;
  border-left: 1px solid #3b474d;
  padding-left: 16px;
}
.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}
.sidebar {
  background: #172126;
  color: #d8e0e3;
  padding: 24px 14px;
  border-right: 1px solid #2d3b41;
}
.nav-label,
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  color: #7f929a;
  margin: 0 10px 10px;
}
.nav-item {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: #bdc9cd;
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
}
.nav-item span {
  font-size: 10px;
  color: #6f828a;
  width: 20px;
}
.nav-item:hover,
.nav-item.active {
  background: #223137;
  color: #fff;
  border-left-color: #32b67a;
}
.sidebar-note {
  margin: 30px 10px 0;
  padding-top: 18px;
  border-top: 1px solid #34444a;
}
.sidebar-note strong {
  font-size: 10px;
  color: #7fd3a7;
}
.sidebar-note p {
  font-size: 11px;
  line-height: 1.7;
  color: #93a4aa;
}
.workspace {
  min-width: 0;
  padding: 28px;
}
.workspace-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.workspace-head h1 {
  font-size: 25px;
  margin: 0 0 5px;
}
.workspace-head p:not(.eyebrow) {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.workspace-head .eyebrow {
  margin: 0 0 7px;
  color: #18794e;
}
.version {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #f8faf9;
  padding: 8px 10px;
  font:
    11px Consolas,
    monospace;
  color: #4f5e64;
}
.metric-band,
.quality-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 18px;
}
.metric-band > div,
.quality-band > div {
  padding: 16px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.metric-band > div:last-child,
.quality-band > div:last-child {
  border-right: 0;
}
.metric-band span,
.quality-band span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.metric-band strong,
.quality-band strong {
  display: block;
  font-size: 25px;
  margin: 6px 0 3px;
}
.metric-band small {
  font-size: 10px;
  color: #819098;
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.panel-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head > div:first-child {
  min-width: 0;
}
.panel-head span {
  font-size: 10px;
  color: #718087;
  font-weight: 800;
}
.panel-head h2 {
  font-size: 16px;
  margin: 3px 0 0;
}
.panel-head > :last-child {
  margin-left: auto;
}
.pipeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pipeline li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e4e9ea;
}
.pipeline li:last-child {
  border-bottom: 0;
}
.pipeline b {
  font:
    12px Consolas,
    monospace;
  color: #18794e;
}
.pipeline strong {
  font-size: 14px;
}
.pipeline p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
  line-height: 1.6;
}
.queue-row {
  padding: 15px 18px;
  border-bottom: 1px solid #e4e9ea;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
}
.queue-row strong {
  font-size: 13px;
}
.queue-row span {
  font-size: 11px;
  font-weight: 700;
}
.queue-row small {
  grid-column: 1/-1;
  color: var(--muted);
}
.queue-row.danger span {
  color: var(--red);
}
.queue-row.warn span {
  color: var(--amber);
}
.quality-summary {
  margin: 18px;
  background: #172126;
  color: #fff;
  padding: 16px;
  border-radius: 4px;
}
.quality-summary span,
.quality-summary small {
  display: block;
  color: #9db0b7;
  font-size: 10px;
}
.quality-summary strong {
  display: block;
  font-size: 20px;
  color: #62d39c;
  margin: 6px 0;
}
.status,
.decision {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}
.status.auto,
.decision.auto {
  background: var(--green-bg);
  color: var(--green);
}
.status.handoff,
.decision.handoff {
  background: var(--red-bg);
  color: var(--red);
}
.status.review {
  background: var(--amber-bg);
  color: var(--amber);
}
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 6px;
}
.toolbar.compact {
  max-width: 520px;
}
.toolbar label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}
.search-field {
  flex: 1;
  min-width: 180px;
}
.toolbar input,
.toolbar select,
.qa-playground textarea {
  border: 1px solid #bac5c8;
  background: #fff;
  border-radius: 4px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  outline: none;
}
.toolbar input:focus,
.toolbar select:focus,
.qa-playground textarea:focus {
  border-color: #18794e;
  box-shadow: 0 0 0 2px #d9f2e5;
}
.primary-command,
.text-command {
  border: 0;
  cursor: pointer;
}
.primary-command {
  min-height: 38px;
  background: #18794e;
  color: #fff;
  padding: 8px 13px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}
.primary-command:hover {
  background: #11643f;
}
.text-command {
  background: transparent;
  color: #1769aa;
  font-size: 12px;
  padding: 6px;
}
.notice {
  font-size: 11px;
  color: #637078;
  margin: 10px 2px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}
th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid #e3e8e9;
  font-size: 11px;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: #f2f5f5;
  color: #5e6d73;
  font-size: 10px;
  text-transform: uppercase;
}
tbody tr:hover {
  background: #f7faf9;
}
.status-ok {
  color: var(--green);
  font-weight: 800;
}
.status-warn {
  color: var(--amber);
  font-weight: 800;
}
.status-danger {
  color: var(--red);
  font-weight: 800;
}
.conversation-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
}
.conversation-list,
.conversation-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 520px;
}
.conversation-list {
  overflow: auto;
}
.conversation-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e2e7e8;
  background: #fff;
  text-align: left;
  padding: 13px 14px;
  cursor: pointer;
}
.conversation-row:hover,
.conversation-row.active {
  background: #eef8f3;
}
.conversation-row.active {
  box-shadow: inset 3px 0 #18794e;
}
.conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.conversation-top strong {
  font-size: 12px;
}
.conversation-top time,
.conversation-row small {
  font-size: 10px;
  color: var(--muted);
}
.conversation-row > span:not(.conversation-top) {
  font-size: 12px;
}
.conversation-detail {
  padding: 18px;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 13px;
  margin-bottom: 18px;
}
.message {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-line;
}
.message.user {
  margin-left: auto;
  background: #eaf4fb;
  border: 1px solid #bed8ea;
}
.message.assistant {
  background: #f4f7f6;
  border: 1px solid #d6dedb;
}
.audit-line {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: #637078;
  font:
    10px Consolas,
    monospace;
}
.quality-band {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.quality-band strong {
  font-size: 18px;
}
.qa-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
}
.qa-playground {
  padding-bottom: 16px;
}
.qa-playground textarea {
  display: block;
  width: calc(100% - 36px);
  height: 92px;
  margin: 16px 18px;
  resize: vertical;
}
.sample-questions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 18px 12px;
}
.sample-questions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 10px;
  cursor: pointer;
}
.decision {
  margin: 0 18px 12px;
}
.answer-block,
.evidence-block {
  border-top: 1px solid var(--line);
  padding: 13px 18px;
}
.answer-block span,
.evidence-block span {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.answer-block p {
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-line;
}
.evidence-block ul {
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.7;
}
.regression-panel {
  min-width: 0;
}
.regression-panel .table-wrap {
  border: 0;
  border-radius: 0;
}
.regression-panel table {
  min-width: 650px;
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: flex;
    overflow: auto;
    scrollbar-width: none;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid #2d3b41;
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }
  .nav-label,
  .sidebar-note {
    display: none;
  }
  .nav-item {
    min-width: 132px;
  }
  .workspace {
    padding: 18px;
  }
  .metric-band {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-band > div:nth-child(2n) {
    border-right: 0;
  }
  .overview-grid,
  .qa-layout {
    grid-template-columns: 1fr;
  }
  .conversation-layout {
    grid-template-columns: 1fr;
  }
  .conversation-list {
    min-height: 240px;
    max-height: 320px;
  }
  .conversation-detail {
    min-height: 420px;
  }
}
@media (max-width: 600px) {
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .brand-copy span,
  .top-status {
    display: none;
  }
  .back-link {
    margin-left: auto;
  }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
    padding: 6px 4px;
  }
  .nav-item {
    min-width: 0;
    height: 50px;
    padding: 4px 2px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
  }
  .nav-item span {
    width: auto;
    font-size: 8px;
  }
  .nav-item:hover,
  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: #32b67a;
  }
  .workspace {
    padding: 14px;
  }
  .workspace-head {
    align-items: flex-start;
  }
  .version {
    display: none;
  }
  .workspace-head h1 {
    font-size: 21px;
  }
  .metric-band,
  .quality-band {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-band > div,
  .quality-band > div {
    border-bottom: 1px solid var(--line);
  }
  .metric-band > div:nth-child(2n),
  .quality-band > div:nth-child(2n) {
    border-right: 0;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar label,
  .search-field {
    width: 100%;
  }
  .qa-playground textarea {
    height: 112px;
  }
  .message {
    max-width: 92%;
  }
}

.model-run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 0;
}
.model-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.model-badge.online {
  border-color: #2f8f6a;
  color: #176541;
  background: #e7f7ef;
}
.model-badge.configured {
  border-color: #4d7ea8;
  color: #285b83;
  background: #edf6fc;
}
.model-badge.fallback {
  border-color: #c4a86a;
  color: #76591b;
  background: #fff8e7;
}
.model-badge.pending {
  color: var(--muted);
  background: #f3f6f7;
}
.model-latency {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.model-note {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.primary-command:disabled {
  cursor: wait;
  opacity: 0.65;
}
