:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #627080;
  --line: #d9e0e8;
  --soft-line: #edf1f5;
  --paper: #f5f7fa;
  --panel: #ffffff;
  --blue: #1464d2;
  --green: #147b5c;
  --red: #b42318;
  --amber: #aa5b00;
  --shadow: 0 14px 38px rgba(20, 34, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.conditional-input {
  display: none;
}

.conditional-input.is-visible {
  display: block;
}

select {
  appearance: none;
  -webkit-appearance: none;
}

.native-select-hidden {
  display: none !important;
}

.admin-root {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 720px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.public-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fbfcfd;
}

.public-shell .workspace-content {
  height: 100%;
}

.sidebar,
.customer-side {
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--line);
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.customer-side {
  border-right: 0;
  border-left: 1px solid var(--line);
  overflow: auto;
}

.side-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--soft-line);
}

.side-head h1,
.panel-title {
  margin: 0;
  font-size: 18px;
}

.side-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.site-switcher {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.site-switcher label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.switcher-menu {
  position: relative;
}

.switcher-menu summary {
  list-style: none;
}

.switcher-menu summary::-webkit-details-marker {
  display: none;
}

.switcher-summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 36px 0 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.switcher-summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.switcher-menu[open] .switcher-summary::after {
  transform: translateY(-25%) rotate(225deg);
}

.switcher-current {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pending-marker {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 3px #ffe8e4;
}

.switcher-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.switcher-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.switcher-option span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.switcher-option:hover,
.switcher-option.active {
  background: #edf4ff;
}

.switcher-option.active span {
  color: var(--blue);
}

.form-select-menu {
  position: relative;
  width: 100%;
  min-width: 128px;
}

.toolbar .form-select-menu {
  width: auto;
  min-width: 150px;
}

.form-select-menu summary {
  list-style: none;
}

.form-select-menu summary::-webkit-details-marker {
  display: none;
}

.form-select-summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 34px 0 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.form-select-summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.form-select-menu[open] .form-select-summary::after {
  transform: translateY(-25%) rotate(225deg);
}

.form-select-current {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.form-select-options {
  position: absolute;
  z-index: 45;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.form-select-option {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.form-select-option:hover,
.form-select-option.active {
  color: var(--blue);
  background: #edf4ff;
}

.form-select-option:disabled,
.form-select-menu.disabled .form-select-summary {
  opacity: 0.55;
  cursor: not-allowed;
}

.conversation-list {
  min-height: 0;
  overflow: auto;
}

.conversation-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  background: #fff;
}

.conversation-card:hover,
.conversation-card.active {
  background: #eef5ff;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.conversation-card-head {
  min-width: 0;
}

.conversation-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.conversation-unread-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 3px #ffe8e4;
}

.conversation-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

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

.customer-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.customer-country-tag {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  max-width: 92px;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  overflow: hidden;
  color: var(--muted);
  background: #edf1f5;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.risk-low {
  color: var(--green);
  background: #e7f5ef;
}

.badge.risk-medium {
  color: var(--amber);
  background: #fff2df;
}

.badge.risk-high {
  color: var(--red);
  background: #ffe8e4;
}

.main-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.main-pane > .workspace-content {
  flex: 1 1 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.topbar-customer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-customer .customer-country-tag {
  max-width: 140px;
  min-height: 24px;
  font-size: 12px;
}

.topbar .meta {
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workspace-nav-stack {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.primary-nav-stack {
  position: relative;
  z-index: 5;
}

.workspace-tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--soft-line);
}

.workspace-tabbar:last-child {
  border-bottom: 0;
}

.public-config-tabbar {
  justify-content: flex-start;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
  background: #fbfcfd;
}

.primary-tabbar {
  min-height: 54px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.primary-tabbar .workspace-tabs {
  flex: 1 1 auto;
}

.primary-nav-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

.test-entry-button {
  min-height: 34px;
  padding: 0 12px;
}

.workspace-tab-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.workspace-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  overflow-x: auto;
}

.workspace-tab {
  min-height: 34px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 850;
}

.workspace-tab.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.workspace-tab-help {
  min-width: 260px;
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.conversation-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.workspace-content {
  height: 100%;
  min-height: 0;
  overflow: auto;
  background: #fbfcfd;
}

.online-workspace-content {
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  flex: 1 1 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.timeline {
  min-height: 0;
  overflow: auto;
  padding: 18px 20px;
}

.message {
  display: grid;
  margin-bottom: 14px;
}

.message.customer {
  justify-items: start;
}

.message.staff,
.message.ai {
  justify-items: end;
}

.bubble {
  max-width: min(680px, 82%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: pre-wrap;
  line-height: 1.55;
}

.message.staff .bubble,
.message.ai .bubble {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

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

.draft-panel {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: #fbfcfd;
  border-left: 1px solid var(--line);
}

.draft-card,
.side-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.draft-card + .draft-card,
.side-card + .side-card {
  margin-top: 12px;
}

.draft-panel > .row + .draft-card {
  margin-top: 12px;
}

.context-kv {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.right-panel-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.draft-text {
  width: 100%;
  min-height: 230px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  line-height: 1.5;
}

.draft-text {
  resize: vertical;
}

.draft-actions,
.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.composer {
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.composer-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
}

.composer-status-line .latest {
  flex: 1 1 260px;
}

.composer-status-line .button {
  flex: 0 0 auto;
}

.composer-status-line + textarea {
  margin-top: 12px;
}

.composer textarea {
  width: 100%;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  resize: vertical;
}

.training-save-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-save-inline input {
  margin: 0;
}

.feedback-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfd;
}

.feedback-panel summary::-webkit-details-marker {
  display: none;
}

.feedback-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.feedback-summary strong,
.feedback-summary small {
  display: block;
}

.feedback-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.issue-check-list {
  padding-top: 2px;
}

.verifier-risk-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, max-content));
  align-items: start;
  gap: 8px;
  margin-top: 0;
}

.guardrail-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.verifier-risk-list label,
.guardrail-tag-list label,
.knowledge-tag-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 180px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: #fbfcfd;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.guardrail-tag-list,
.knowledge-tag-list {
  margin-top: 0;
}

.guardrail-tag-list label,
.knowledge-tag-list label {
  min-height: 30px;
  padding: 0 11px;
}

.verifier-risk-list input,
.guardrail-tag-list input,
.knowledge-tag-list input {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}

.verifier-risk-list span,
.guardrail-tag-list span,
.knowledge-tag-list span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.feedback-reason {
  margin-top: 10px;
  min-height: 54px !important;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
}

.button.primary {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.button.danger {
  color: var(--red);
  border-color: #ffc9c2;
  background: #fff5f3;
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.side-section {
  padding: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
  align-content: start;
}

.info-grid .side-card + .side-card {
  margin-top: 0;
}

.info-grid .eval-case-card,
.info-grid .acceptance-card,
.info-grid .overview-card,
.info-grid .trace-card {
  grid-column: 1 / -1;
}

.overview-card {
  background: #fff;
}

.overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.overview-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.overview-card .overview-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.overview-card .metric-card {
  min-height: 62px;
}

.overview-card .metric-card strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-actions {
  margin-top: 12px;
}

.action-flow-card {
  align-self: start;
}

.info-grid .reply-guardrail-card {
  grid-column: 1 / -1;
}

.info-grid .verifier-test-card,
.info-grid .verifier-intercept-card {
  grid-column: 1 / -1;
}

.info-grid .analytics-card {
  grid-column: 1 / -1;
}

.action-flow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.action-flow-head > div:first-child {
  min-width: 0;
}

.action-flow-tags {
  margin-top: 10px;
}

.action-flow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.reply-guardrail-card {
  align-self: stretch;
}

.reply-guardrail-card .action-flow-head {
  align-items: center;
}

.reply-guardrail-card .action-flow-grid {
  grid-template-columns:
    minmax(220px, 0.9fr)
    minmax(300px, 1.2fr)
    minmax(260px, 1fr)
    minmax(220px, 0.9fr);
}

.reply-guardrail-card .knowledge-item {
  min-width: 0;
}

.reply-guardrail-card .knowledge-item strong {
  white-space: nowrap;
}

.reply-guardrail-card .knowledge-item p {
  overflow-wrap: anywhere;
}

.channel-item-card,
.channel-account-item {
  align-self: start;
}

.channel-account-item.selected {
  border-color: #c9d7ea;
  background: #eef5ff;
}

.channel-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.verifier-test-form {
  margin-top: 12px;
}

.verifier-test-form textarea {
  min-height: 120px;
}

.verifier-risk-field {
  grid-column: 1 / -1;
}

.verifier-intercept-grid {
  grid-template-columns:
    minmax(260px, 1.2fr)
    minmax(260px, 1.2fr)
    minmax(180px, 0.8fr)
    minmax(180px, 0.8fr);
}

.analytics-metrics {
  grid-template-columns: repeat(8, minmax(120px, 1fr));
}

.analytics-small-grid,
.analytics-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analytics-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.analytics-row strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-row p {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.analytics-row-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.analytics-row-side span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analytics-gap-item .row {
  margin-bottom: 6px;
}

.qa-review-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.qa-review-item {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.qa-review-item.completed {
  background: #f8fbf9;
}

.qa-review-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.qa-review-head strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qa-review-head p {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.qa-review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.qa-review-body,
.qa-review-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.qa-review-form-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.qa-review-form-panel {
  margin-top: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
}

.qa-review-form-panel summary {
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.qa-review-form-panel form {
  padding: 0 10px 10px;
}

.qa-review-form-panel textarea {
  min-height: 74px;
}

.qa-review-result {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #cfeedd;
  border-radius: 7px;
  background: #f5fbf7;
}

.qa-review-result strong {
  display: block;
  color: var(--green);
  font-size: 13px;
}

.qa-review-result p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.soft-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 3px 4px 0 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  vertical-align: middle;
}

.action-step-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.action-step > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.action-step strong {
  display: block;
}

.action-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-line);
  font-size: 14px;
}

.kv span:first-child {
  color: var(--muted);
}

.text-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ticket-assignment input {
  min-width: 180px;
  flex: 1 1 180px;
}

.knowledge-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.knowledge-list.compact .knowledge-item p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.knowledge-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.kb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
}

.modal-panel {
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--soft-line);
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-body {
  --modal-body-x: 20px;
  --modal-body-bottom: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px var(--modal-body-x) var(--modal-body-bottom);
}

.knowledge-form,
.action-flow-form,
.reply-guardrail-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.modal-actions {
  position: sticky;
  bottom: calc(-1 * var(--modal-body-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px calc(-1 * var(--modal-body-x)) calc(-1 * var(--modal-body-bottom));
  padding: 12px var(--modal-body-x) 16px;
  border-top: 1px solid var(--soft-line);
  background: #fff;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ink);
  background: #f6f8fb;
}

.action-flow-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.action-channel-list,
.action-flow-options {
  margin-top: 0;
}

.action-mapping-panel {
  margin-top: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfd;
}

.action-mapping-panel summary {
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.action-mapping-panel .kb-grid {
  padding: 0 10px 10px;
}

.eval-case-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.eval-case-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

.eval-case-create,
.eval-case-import {
  margin-top: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.eval-case-create summary,
.eval-case-import summary {
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.eval-case-create form,
.eval-case-import form {
  padding: 0 10px 10px;
}

.eval-case-import textarea {
  min-height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.inline-check {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.import-result {
  margin: 0 10px 10px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
}

.import-result strong {
  display: block;
  font-size: 13px;
}

.import-result p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.eval-case-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.eval-case-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.eval-case-item strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eval-case-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.activation-quality {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 850;
}

.activation-quality.ready {
  color: var(--green);
}

.activation-quality.needs-review {
  color: var(--red);
}

.eval-case-controls {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.eval-case-review {
  grid-column: 1 / -1;
  border-top: 1px solid var(--soft-line);
  padding-top: 8px;
}

.eval-case-review summary {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.eval-case-review form {
  margin-top: 10px;
}

.eval-case-review textarea {
  min-height: 78px;
}

.eval-case-revisions {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--soft-line);
}

.eval-case-revisions > strong {
  font-size: 12px;
}

.eval-case-revision-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
}

.eval-case-revision-item span {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.eval-case-revision-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.training-candidate-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.training-candidate-list > strong {
  color: var(--ink);
  font-size: 13px;
}

.training-candidate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.training-candidate-item span {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.training-candidate-item p,
.training-candidate-item small {
  display: block;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
}

.training-candidate-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.knowledge-item {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.knowledge-item strong {
  display: block;
  margin-bottom: 5px;
}

.knowledge-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.trace-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.trace-item {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.trace-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-item p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.evaluation-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.metric-card {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.metric-filter-card {
  width: 100%;
  text-align: left;
  appearance: none;
}

.metric-filter-card:hover {
  border-color: #c9d7ea;
  background: #f6f9fe;
}

.metric-filter-card.is-active {
  border-color: var(--blue);
  background: #eef5ff;
  box-shadow: inset 0 0 0 1px rgba(20, 100, 210, 0.12);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.metric-card strong.risk-low {
  color: var(--green);
}

.metric-card strong.risk-medium {
  color: var(--amber);
}

.metric-card strong.risk-high {
  color: var(--red);
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--soft-line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.eval-matrix {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.eval-axis {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.eval-axis span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.eval-axis p {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
}

.eval-axis em {
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  font-weight: 850;
}

.eval-axis em.risk-low {
  background: #e6f7ee;
  color: var(--green);
}

.eval-axis em.risk-high {
  background: #fff0ed;
  color: var(--red);
}

.eval-failures {
  display: grid;
  gap: 8px;
}

.eval-failures > strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.eval-failure-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 8px;
  border: 1px solid #ffd4cd;
  border-radius: 7px;
  background: #fff8f6;
}

.eval-failure-item span,
.eval-failure-item strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eval-failure-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.eval-failure-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.eval-failure-item strong.risk-low {
  color: var(--green);
}

.eval-failure-item strong.risk-medium {
  color: var(--amber);
}

.eval-failure-item strong.risk-high {
  color: var(--red);
}

.shadow-card {
  border-color: #cfd9e6;
  background: #ffffff;
}

.shadow-card.failed {
  border-color: #ffc9c2;
  background: #fff7f5;
}

.shadow-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.shadow-metrics div {
  min-height: 54px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.shadow-metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.shadow-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.shadow-excerpt {
  max-height: 160px;
  overflow: auto;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.gate-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.snapshot-item {
  margin-top: 12px;
}

.gate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.gate-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-item strong {
  color: var(--ink);
  font-size: 12px;
}

.gate-item.passed {
  border-color: #c8eadc;
}

.gate-item.passed strong {
  color: var(--green);
}

.gate-item.failed {
  border-color: #ffc9c2;
  background: #fff7f5;
}

.gate-item.failed strong {
  color: var(--red);
}

.compact-toolbar {
  gap: 6px;
}

.compact-toolbar .button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.action-details {
  position: relative;
}

.action-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

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

.action-details[open] summary {
  border-color: var(--blue);
}

.action-details > .toolbar {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcfd;
}

.self-check-grid {
  margin-top: 10px;
  border-top: 1px solid var(--soft-line);
}

.self-check-grid .kv {
  grid-template-columns: 68px minmax(0, 1fr);
  font-size: 12px;
}

.self-check-grid .kv span:last-child {
  overflow-wrap: anywhere;
}

.verifier-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.verifier-card.blocked {
  border-color: #ffc9c2;
  background: #fff7f5;
}

.verifier-card.clear {
  border-color: #ffe0b5;
  background: #fffaf2;
}

.verifier-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.mini-list strong {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
}

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

.error {
  margin-top: 10px;
  color: var(--red);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

  .draft-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .overview-card .overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .reply-guardrail-card .action-flow-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .verifier-intercept-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .admin-root {
    height: auto;
    min-height: 100vh;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 360px;
  }

  .conversation-list {
    height: 280px;
  }

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

  .workspace-tabbar {
    align-items: stretch;
    flex-direction: column;
  }

  .public-config-tabbar {
    gap: 8px;
  }

  .workspace-tab-help {
    min-width: 0;
    max-width: none;
    text-align: left;
  }

  .composer-status-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-head {
    flex-direction: column;
  }

  .overview-card .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-metrics,
  .analytics-small-grid,
  .analytics-two-column,
  .analytics-row,
  .qa-review-head,
  .qa-review-body,
  .qa-review-form-grid {
    grid-template-columns: 1fr;
  }

  .analytics-row-side,
  .qa-review-actions {
    justify-items: start;
    justify-content: flex-start;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 12px;
  }

  .modal-panel {
    max-height: calc(100vh - 24px);
  }

  .modal-body {
    --modal-body-x: 14px;
    --modal-body-bottom: 14px;
    padding: 14px;
  }

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

  .action-flow-grid {
    grid-template-columns: 1fr;
  }

  .reply-guardrail-card .action-flow-head {
    align-items: stretch;
    flex-direction: column;
  }

  .reply-guardrail-card .action-flow-controls {
    justify-content: flex-start;
  }

  .reply-guardrail-card .action-flow-grid {
    grid-template-columns: 1fr;
  }

  .verifier-intercept-grid {
    grid-template-columns: 1fr;
  }
}
