:root {
  color-scheme: light;
  --ink: #191f28;
  --ink-2: #4e5968;
  --muted: #8b95a1;
  --line: #f2f4f6;
  --line-strong: #e5e8eb;
  --panel: #ffffff;
  --bg: #f9fafb;
  --soft: #f2f4f6;
  --soft-2: #f7f8fa;
  --accent: #3182f6;
  --accent-strong: #1b64da;
  --accent-soft: #e8f3ff;
  --good: #00b894;
  --good-soft: #e6f7f2;
  --warn: #f59f00;
  --danger: #f04438;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow: 0 6px 20px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.08);
  --font: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/packages/pretendard/dist/web/variable/woff2/PretendardVariable.woff2") format("woff2-variations");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

button {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  height: 44px;
  padding: 0 18px;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

button.secondary,
.section-head button {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}

button.secondary:hover:not(:disabled),
.section-head button:hover:not(:disabled) {
  background: var(--line-strong);
}

button.ghost {
  background: transparent;
  color: var(--ink-2);
  height: 36px;
  padding: 0 10px;
}

button.ghost:hover:not(:disabled) {
  background: var(--soft);
}

input[type="text"],
input[type="search"],
input[type="file"],
select,
textarea {
  height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--soft);
  padding: 0 14px;
  width: 100%;
  outline: none;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 130, 246, 0.12);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%238b95a1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 30% 20%, var(--accent-soft) 0%, var(--bg) 60%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.login-card .brand-logo {
  height: 24px;
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.login-card p {
  font-size: 14px;
  line-height: 1.55;
}

.login-card .small {
  font-size: 12px;
  margin-top: 4px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 999px;
  height: 48px;
  padding: 0 22px;
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  margin-top: 8px;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.login-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px rgba(49, 130, 246, 0.1);
}

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

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  width: auto;
  height: 22px;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

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

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
}

.sidebar > section {
  margin-bottom: 28px;
}

.upload-panel {
  background: var(--soft-2);
  border-radius: var(--radius);
  padding: 18px;
}

.dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--soft);
  color: var(--accent);
  flex-shrink: 0;
}

.dropzone.has-file .dropzone-icon {
  background: #fff;
}

.dropzone-text {
  min-width: 0;
}

.dropzone-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-text span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.upload-progress {
  display: grid;
  gap: 6px;
}

.upload-progress-bar {
  height: 6px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  transition: width 240ms ease;
}

.upload-progress-step {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
  margin: 0;
}

.upload-panel h2 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-panel .muted {
  font-size: 12.5px;
  line-height: 1.45;
}

#uploadForm {
  display: grid;
  gap: 10px;
  margin: 14px 0 10px;
}

input[type="file"] {
  height: auto;
  padding: 10px 12px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

.section-head button {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.doc-list {
  display: grid;
  gap: 6px;
}

.doc-item {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  height: auto;
  font-weight: 500;
  transition: background 120ms ease;
}

.doc-item:hover {
  background: var(--soft);
}

.doc-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.doc-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  font-weight: 500;
}

.doc-item.active span {
  color: var(--accent);
}

.doc-pager {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 0 4px;
}

.doc-pager span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  font-weight: 500;
}

.doc-pager button {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.workspace {
  min-width: 0;
  padding: 32px 40px 48px;
  max-width: 1400px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: 16px;
}

.topbar .eyebrow {
  margin-bottom: 6px;
}

.topbar h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.ok {
  background: var(--good-soft);
  color: var(--good);
}

.status-dot.ok::before {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.15);
}

.query-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 20px;
}

.tabs {
  display: inline-flex;
  background: var(--soft);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 2px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  height: 36px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  transition: background 120ms ease, color 120ms ease;
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.query-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 140px auto;
  gap: 10px;
  align-items: center;
}

.query-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  height: 48px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.query-input-wrap:focus-within {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 130, 246, 0.12);
}

.query-input-wrap::before {
  content: "";
  width: 18px;
  height: 18px;
  margin: 0 6px 0 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
}

.query-input-wrap span {
  display: none;
}

.query-input-wrap input {
  border: 0;
  background: transparent;
  height: 100%;
  padding: 0 12px 0 0;
  flex: 1;
  min-width: 0;
}

.query-input-wrap input:focus {
  box-shadow: none;
  background: transparent;
}

.query-form button[type="submit"] {
  min-width: 96px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.85fr);
  gap: 20px;
}

.main-result,
.detail-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-width: 0;
  min-height: 560px;
}

.main-result .section-head h2,
.detail-panel .section-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink-2);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
}

.answer-box {
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #f3f8ff 100%);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.65;
  font-family: var(--font);
}

.answer-box:empty {
  display: none;
}

.results {
  display: grid;
  gap: 10px;
}

.result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.result-card:hover {
  border-color: var(--line-strong);
  background: var(--soft-2);
}

.result-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.result-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.result-card h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.result-card p {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.meta-row span {
  background: var(--soft);
  border-radius: 6px;
  color: var(--ink-2);
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.detail-view {
  display: grid;
  gap: 16px;
}

.detail-view pre {
  overflow: auto;
  max-height: 320px;
  background: var(--soft-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.doc-reader,
.evidence-detail {
  display: grid;
  gap: 14px;
}

.doc-reader-head h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.doc-reader-head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.page-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  background: var(--soft-2);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.page-controls span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  min-width: 64px;
  text-align: center;
}

.page-controls button {
  height: 36px;
  font-size: 13px;
}

.page-text {
  min-height: 200px;
  max-height: 480px;
  background: var(--soft-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 8px 0 0;
}

.page-image {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--soft-2);
  border: 1px solid var(--line);
  position: relative;
}

.page-image img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.page-image-fallback {
  display: none;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.page-image.failed img { display: none; }
.page-image.failed .page-image-fallback { display: block; }

.page-image.unavailable {
  display: grid;
  gap: 6px;
  padding: 28px 18px;
  text-align: center;
  color: var(--ink-2);
}

.page-image.unavailable strong {
  font-size: 14px;
  color: var(--ink);
}

.page-image.unavailable span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.evidence-text p {
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink);
  font-size: 14px;
}

details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft-2);
  padding: 12px 14px;
}

details[open] {
  background: #fff;
}

summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}

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

summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 120ms ease;
}

details[open] summary::before {
  transform: rotate(90deg);
}

.field {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.field:last-of-type {
  border-bottom: 0;
}

.field b {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}

.open-source-page {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}

.open-source-page:hover:not(:disabled) {
  background: var(--line-strong);
}

.settings-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--soft-2);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: auto;
  height: auto;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  transition: background 120ms ease;
}

.settings-card:hover {
  background: var(--line-strong);
}

.settings-card img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--line-strong);
  object-fit: cover;
}

.settings-card .user-meta {
  min-width: 0;
  flex: 1;
}

.settings-card .user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card .user-meta span {
  display: block;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card .settings-icon {
  color: var(--muted);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.user-menu {
  display: grid;
  gap: 8px;
  padding: 10px;
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.user-menu[hidden] {
  display: none;
}

.user-menu button {
  width: 100%;
  justify-content: flex-start;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 12px;
}

.modal-head h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-head .eyebrow {
  margin-bottom: 4px;
}

.modal-head .ghost {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  color: var(--muted);
}

.settings-tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  height: 40px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.settings-tab:hover:not(.active) {
  color: var(--ink-2);
  background: transparent;
}

.settings-tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  background: transparent;
}

.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  display: grid;
  gap: 18px;
}

.settings-panel {
  display: grid;
  gap: 18px;
}

.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--soft-2);
  border-radius: var(--radius);
}

.settings-profile img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line-strong);
}

.settings-profile strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.settings-profile span {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-row strong {
  font-size: 14px;
  font-weight: 600;
}

.settings-row .small {
  font-size: 12.5px;
  margin-top: 2px;
}

.mcp-step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.mcp-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mcp-step-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.mcp-step-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.mcp-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}

.mcp-list code,
.modal-body code {
  background: var(--soft);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.muted.small {
  font-size: 12.5px;
}

.code-block {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 14px 14px 14px 14px;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}

.code-copy:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.link {
  background: transparent;
  color: var(--accent);
  height: auto;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

.link:hover:not(:disabled) {
  background: var(--accent-soft);
}

.token-list {
  display: grid;
  gap: 6px;
}

.token-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--soft-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.token-item .token-info {
  flex: 1;
  min-width: 0;
}

.token-item strong {
  display: block;
  font-weight: 600;
}

.token-item .small {
  font-size: 11.5px;
}

.token-item .token-prefix {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  font-size: 12px;
}

.token-item button {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.token-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.new-token {
  background: var(--good-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.new-token .small {
  color: var(--good);
  margin: 0;
}

.mcp-troubleshoot {
  background: var(--soft-2);
}

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

.chat-view {
  display: flex;
  flex-direction: column;
  min-height: 460px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px 16px;
}

.chat-empty {
  text-align: center;
  padding: 48px 20px 32px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.chat-empty-icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-empty h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-empty p {
  color: var(--muted);
  font-size: 14px;
  max-width: 380px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.suggestion {
  background: var(--soft);
  color: var(--ink-2);
  font-weight: 500;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 999px;
}

.suggestion:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 92%;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  background: var(--soft);
  color: var(--ink-2);
}

.chat-message.assistant .chat-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.chat-bubble {
  background: var(--soft);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.chat-message.assistant .chat-bubble {
  border-bottom-left-radius: 6px;
}

.chat-bubble.error {
  background: #fff1f0;
  color: var(--danger);
}

.chat-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.citation-chip::before {
  content: attr(data-index);
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
}

.citation-chip:hover,
.citation-chip.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state svg {
  margin-bottom: 12px;
  color: var(--line-strong);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1080px) {
  .result-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 24px 20px 40px;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 20px 16px 32px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .query-form {
    grid-template-columns: 1fr;
  }

  .main-result,
  .detail-panel {
    padding: 18px;
  }
}
