:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --line: #dbe5e2;
  --ink: #152321;
  --muted: #61716e;
  --teal: #0f6b63;
  --teal-soft: #e4f3f0;
  --coral: #d9583b;
  --gold: #b67b12;
  --shadow: 0 16px 44px rgba(21, 35, 33, 0.08);
  --font-latin: "MerchantFAQ Latin", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-zh: "MerchantFAQ CJK", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --font-ui: "Source Han Sans SC", "Source Han Sans CN", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --code-bg: #2b2d2e;
  --code-ink: #eef2f1;
}

@font-face {
  font-family: "MerchantFAQ Latin";
  src:
    local("Palatino Linotype"),
    local("Book Antiqua"),
    local("Georgia"),
    local("Times New Roman");
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF;
}

@font-face {
  font-family: "MerchantFAQ CJK";
  src:
    local("Songti SC"),
    local("Noto Serif CJK SC"),
    local("Source Han Serif SC"),
    local("SimSun");
  unicode-range:
    U+2E80-2EFF,
    U+3000-303F,
    U+31C0-31EF,
    U+3400-4DBF,
    U+4E00-9FFF,
    U+F900-FAFF,
    U+FF00-FFEF;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 9% 8%, rgba(15, 107, 99, 0.1), transparent 34%),
    radial-gradient(circle at 92% 12%, rgba(217, 88, 59, 0.08), transparent 30%),
    linear-gradient(135deg, #f7f8f4 0%, #edf4f1 52%, #f3f6f8 100%);
  color: var(--ink);
  font-family: var(--font-latin), var(--font-zh);
}

.app-view {
  display: none;
}

.app-view.active {
  display: grid;
}

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

.home-kicker,
.home-action span,
.tiny-button,
.brand,
.sidebar-tab,
.merchant-item-name,
.session-item-title,
.ghost-button,
.tab,
.composer button,
.panel-title,
.kv-label,
.tool-event-head,
.tool-event-chip,
.detail-row span,
.dataset-header-actions,
.dataset-tab,
.filter-field,
.filter-field select,
.dataset-result-head,
.dataset-item-title,
.dataset-badges span,
.dataset-detail-card h2,
.dataset-section h3,
.dataset-message-role,
.dataset-tool-call {
  font-family: var(--font-ui);
}

.home-view {
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.home-card {
  width: min(880px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 34px;
}

.home-kicker {
  color: var(--teal);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-card h1,
.dataset-header h1 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.18;
}

.home-card p,
.dataset-header p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.75;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.home-action {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.home-action.primary {
  border-color: rgba(15, 107, 99, 0.32);
  background: linear-gradient(180deg, #f3fbf8, #e7f4f1);
}

.home-action:hover {
  border-color: rgba(15, 107, 99, 0.48);
  box-shadow: 0 14px 34px rgba(21, 35, 33, 0.09);
  transform: translateY(-1px);
}

.home-action span {
  display: block;
  font-size: 21px;
  font-weight: 780;
}

.home-action small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.home-stats {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  height: 100vh;
}

.app-shell.app-view {
  display: none;
}

.app-shell.app-view.active {
  display: grid;
}

.sidebar {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-row,
.merchant-panel,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.tiny-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
}

.tiny-button:hover {
  color: var(--teal);
  border-color: rgba(15, 107, 99, 0.34);
}

.brand {
  font-size: 25px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.subbrand,
.merchant-meta,
.panel-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
}

.rate-limit-meter {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.rate-limit-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(97, 113, 110, 0.18);
}

.rate-limit-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 0.18s ease, background-color 0.18s ease;
}

.rate-limit-meter.ok .rate-limit-fill {
  background: #1f9d62;
}

.rate-limit-meter.warn .rate-limit-fill {
  background: #d49a1e;
}

.rate-limit-meter.danger .rate-limit-fill {
  background: #d9583b;
}

.rate-limit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.sidebar-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  cursor: pointer;
}

.sidebar-tab.active {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 740;
}

.sidebar-pane {
  min-width: 0;
  min-height: 0;
  display: none;
  flex: 1;
}

.sidebar-pane.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  outline: none;
}

.search-box input:focus,
.composer textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 107, 99, 0.12);
}

.merchant-list,
.session-list {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  display: grid;
  align-content: start;
  gap: 10px;
  scrollbar-color: rgba(15, 107, 99, 0.45) rgba(216, 224, 227, 0.55);
  scrollbar-width: thin;
}

.merchant-list::-webkit-scrollbar,
.session-list::-webkit-scrollbar {
  width: 9px;
}

.merchant-list::-webkit-scrollbar-thumb,
.session-list::-webkit-scrollbar-thumb {
  background: rgba(15, 107, 99, 0.42);
  border-radius: 999px;
}

.merchant-list::-webkit-scrollbar-track,
.session-list::-webkit-scrollbar-track {
  background: rgba(216, 224, 227, 0.45);
  border-radius: 999px;
}

.merchant-item,
.session-item {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.merchant-item:hover,
.session-item:hover {
  border-color: rgba(15, 107, 99, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(21, 35, 33, 0.08);
}

.merchant-item.active,
.session-item.active {
  border-color: var(--teal);
  background: linear-gradient(180deg, #eff8f5, #e7f3f0);
}

.session-item.locked {
  border-color: rgba(217, 88, 59, 0.28);
}

.merchant-item-name,
.session-item-title {
  min-width: 0;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merchant-item-meta,
.session-item-meta,
.session-item-preview,
.session-item-time {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.session-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.session-item-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item-preview {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item-time {
  font-variant-numeric: tabular-nums;
}

.sidebar-empty {
  margin: 12px 0;
  padding: 18px 8px;
}

.main {
  min-width: 0;
  min-height: 0;
  padding: 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.merchant-panel,
.workspace {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.merchant-panel {
  padding: 18px 20px;
}

.merchant-name {
  font-size: 24px;
  font-weight: 780;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: var(--teal);
}

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

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(251, 252, 252, 0.96), rgba(246, 249, 248, 0.96));
  overflow-x: auto;
}

.tab {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
  background: #f1f5f5;
}

.tab.active {
  color: var(--teal);
  border-color: rgba(15, 107, 99, 0.25);
  background: #eef7f4;
  font-weight: 720;
}

.tab-body {
  min-height: 0;
  display: none;
  overflow: hidden;
}

.tab-body.active {
  display: grid;
}

#tab-chat {
  grid-template-rows: minmax(0, 1fr) auto;
}

#tab-trace,
#tab-profile,
#tab-docs,
#tab-reviews {
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-log {
  overflow: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.empty-state {
  margin: auto;
  max-width: 560px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

.message {
  max-width: min(900px, 92%);
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.68;
}

.message.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #0f6b63, #0b5751);
  max-width: min(620px, 78%);
  border-radius: 19px 19px 5px 19px;
  padding: 12px 16px;
  box-shadow: 0 10px 26px rgba(15, 107, 99, 0.18);
}

.message.assistant {
  align-self: flex-start;
  background: transparent;
  border: 0;
  padding: 2px 0;
  font-size: 16px;
}

.message.meta {
  align-self: center;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0;
}

.session-limit {
  align-self: center;
  max-width: 620px;
  border: 1px solid rgba(217, 88, 59, 0.22);
  border-radius: 999px;
  background: rgba(217, 88, 59, 0.08);
  color: var(--coral);
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 14px;
  text-align: center;
}

.message.tool-event {
  align-self: stretch;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  color: #50635f;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 251, 250, 0.92));
  border: 1px solid rgba(128, 151, 146, 0.24);
  border-left: 3px solid rgba(15, 107, 99, 0.34);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  padding: 9px 11px 9px 9px;
  overflow: hidden;
  box-shadow: 0 7px 20px rgba(21, 35, 33, 0.045);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.message.tool-event.expanded {
  background: #fcfdfd;
  border-color: rgba(15, 107, 99, 0.28);
}

.tool-event-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 9px;
  min-width: 0;
  width: 100%;
}

.message.tool-event:hover,
.message.tool-event:focus-visible {
  border-color: rgba(15, 107, 99, 0.42);
  box-shadow: 0 11px 26px rgba(21, 35, 33, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.message.tool-event:hover .tool-event-line {
  color: var(--teal);
}

.tool-event--pending {
  border-left-color: rgba(182, 123, 18, 0.7);
}

.tool-event--ok {
  border-left-color: rgba(15, 107, 99, 0.72);
}

.tool-event--failed {
  border-left-color: rgba(217, 88, 59, 0.72);
}

.tool-event-caret {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(15, 107, 99, 0.08);
  color: var(--teal);
  flex: none;
}

.tool-event-caret::before {
  content: "▸";
  font-size: 11px;
  transform: translateX(1px);
}

.tool-event.expanded .tool-event-caret::before {
  content: "▾";
  transform: translateY(-1px);
}

.tool-event-line {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 22px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tool-event-line::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 107, 99, 0.08);
  flex: none;
}

.tool-event--pending .tool-event-line::before {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(182, 123, 18, 0.1);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.tool-event--failed .tool-event-line::before {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(217, 88, 59, 0.1);
}

.tool-event-chip {
  justify-self: end;
  border: 1px solid rgba(15, 107, 99, 0.14);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(15, 107, 99, 0.07);
  color: var(--teal);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tool-event--pending .tool-event-chip {
  border-color: rgba(182, 123, 18, 0.18);
  background: rgba(182, 123, 18, 0.09);
  color: #8f610f;
}

.tool-event--failed .tool-event-chip {
  border-color: rgba(217, 88, 59, 0.18);
  background: rgba(217, 88, 59, 0.09);
  color: var(--coral);
}

.tool-event-detail {
  display: block;
  position: static;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-height: min(460px, 55vh);
  overflow: auto;
  margin: 10px -11px -9px -9px;
  padding: 13px 14px 15px;
  border: 0;
  border-top: 1px solid rgba(128, 151, 146, 0.24);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.detail-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 4px 0;
  white-space: normal;
}

.detail-row span {
  color: var(--muted);
}

.detail-note,
.detail-quote {
  margin-top: 8px;
  white-space: normal;
}

.detail-note.warning {
  color: var(--gold);
}

.detail-quote {
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.detail-json {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  padding: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.composer textarea {
  resize: none;
  min-height: 54px;
  max-height: 160px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.96);
}

.composer textarea:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: rgba(238, 243, 242, 0.72);
}

.composer button {
  min-width: 86px;
  border: 1px solid rgba(15, 107, 99, 0.26);
  border-radius: 999px;
  background: linear-gradient(180deg, #f7fbfa, #e9f4f1);
  color: var(--teal);
  font-weight: 740;
  padding: 0 22px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 107, 99, 0.08);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.composer button:hover,
.composer button:focus-visible {
  border-color: rgba(15, 107, 99, 0.44);
  background: linear-gradient(180deg, #ffffff, #dff0ec);
  box-shadow: 0 12px 26px rgba(15, 107, 99, 0.13);
  outline: none;
  transform: translateY(-1px);
}

.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

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

.panel-title {
  font-weight: 760;
}

.trace-list,
.review-list,
.document-view,
.info-grid {
  overflow: auto;
  padding: 18px;
}

.trace-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.trace-item,
.info-card,
.review-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.trace-item {
  padding: 13px 14px;
  border-left: 3px solid rgba(15, 107, 99, 0.4);
  box-shadow: 0 8px 22px rgba(21, 35, 33, 0.045);
}

.trace-item--pending {
  border-left-color: rgba(182, 123, 18, 0.74);
}

.trace-item--ok {
  border-left-color: rgba(15, 107, 99, 0.74);
}

.trace-item--failed {
  border-left-color: rgba(217, 88, 59, 0.74);
}

.trace-tool,
.review-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}

.trace-tool-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trace-status {
  border: 1px solid rgba(15, 107, 99, 0.14);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(15, 107, 99, 0.07);
  color: var(--teal);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.trace-warning {
  color: var(--gold);
  font-size: 12px;
  margin-top: 6px;
}

.trace-json {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.info-card {
  padding: 16px;
}

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

.info-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #eef2f3;
}

.kv:first-of-type {
  border-top: 0;
}

.kv-label,
.muted-line,
.doc-meta {
  color: var(--muted);
  font-size: 13px;
}

.kv-value {
  min-width: 0;
  word-break: break-word;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.doc-text {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.68;
}

.markdown-body {
  line-height: 1.72;
  max-width: 920px;
}

.markdown-body p {
  margin: 0 0 14px;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body ul {
  margin: 8px 0 16px;
  padding-left: 22px;
}

.markdown-body li {
  margin: 7px 0;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 14px 0 8px;
  font-size: 16px;
}

.markdown-body code {
  border: 1px solid rgba(21, 35, 33, 0.12);
  border-radius: 5px;
  padding: 1px 6px;
  background: #eef3f2;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.markdown-body pre {
  margin: 14px 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  overflow: auto;
}

.markdown-body pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-body blockquote {
  margin: 12px 0;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.review-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.review-item {
  padding: 14px;
}

.review-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.review-text {
  line-height: 1.7;
}

.dataset-shell {
  height: 100vh;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 24px;
  gap: 18px;
}

.dataset-header,
.dataset-browser {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.dataset-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
}

.dataset-header h1 {
  font-size: 28px;
}

.dataset-header-actions {
  display: flex;
  gap: 10px;
  flex: none;
}

.dataset-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 20;
  max-width: min(680px, calc(100vw - 40px));
  transform: translate(-50%, -12px);
  border: 1px solid rgba(217, 88, 59, 0.24);
  border-left: 4px solid var(--coral);
  border-radius: 10px;
  background: rgba(255, 248, 246, 0.98);
  box-shadow: 0 14px 34px rgba(21, 35, 33, 0.14);
  color: #8f3425;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 680;
  line-height: 1.55;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dataset-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ghost-button.strong {
  color: var(--teal);
  border-color: rgba(15, 107, 99, 0.28);
  background: var(--teal-soft);
}

.dataset-browser {
  min-height: 0;
  display: grid;
  grid-template-columns: 270px 390px minmax(0, 1fr);
  overflow: hidden;
}

.dataset-controls {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.dataset-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.dataset-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  cursor: pointer;
}

.dataset-tab.active {
  color: var(--teal);
  background: var(--teal-soft);
  font-weight: 740;
}

.filter-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.filter-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.dataset-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.dataset-results {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.dataset-result-head {
  min-width: 0;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dataset-result-head > div:first-child {
  min-width: 0;
}

.dataset-list {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.dataset-item {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 13px;
  text-align: left;
  cursor: pointer;
}

.dataset-item:hover,
.dataset-item.active {
  border-color: rgba(15, 107, 99, 0.45);
  background: #f5fbf9;
}

.dataset-item-title {
  font-weight: 760;
  line-height: 1.4;
}

.dataset-item-subtitle,
.dataset-item-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.dataset-item-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.dataset-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dataset-badges span {
  border: 1px solid rgba(15, 107, 99, 0.14);
  border-radius: 999px;
  background: rgba(15, 107, 99, 0.07);
  color: var(--teal);
  font-size: 11px;
  line-height: 1;
  padding: 5px 8px;
}

.dataset-detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.dataset-detail-inner {
  min-height: 100%;
}

.dataset-detail-card {
  max-width: 940px;
}

.dataset-detail-card h2 {
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.35;
}

.dataset-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dataset-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.dataset-section p,
.dataset-section li {
  line-height: 1.72;
}

.dataset-section pre {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-mono);
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.55;
}

.dataset-message-list {
  display: grid;
  gap: 10px;
}

.dataset-message {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
}

.dataset-message--assistant {
  border-left: 3px solid rgba(15, 107, 99, 0.58);
}

.dataset-message--tool {
  border-left: 3px solid rgba(182, 123, 18, 0.64);
}

.dataset-message--user {
  border-left: 3px solid rgba(217, 88, 59, 0.58);
}

.dataset-message-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

.dataset-message-content,
.dataset-tool-call {
  margin-top: 7px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
}

.dataset-tool-call {
  border-radius: 8px;
  background: #f0f5f4;
  color: var(--teal);
  padding: 8px 10px;
  font-size: 12px;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
    height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

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

  .main {
    min-height: 760px;
  }

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

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

  .composer button {
    min-height: 44px;
  }

  .home-actions,
  .dataset-browser {
    grid-template-columns: 1fr;
  }

  .dataset-shell {
    height: auto;
  }

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

  .dataset-header-actions {
    flex-wrap: wrap;
  }

  .dataset-controls,
  .dataset-results {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dataset-list,
  .dataset-detail {
    max-height: none;
  }
}
