:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe3e8;
  --ink: #17202a;
  --muted: #667085;
  --accent: #1769e0;
  --accent-dark: #0f4eac;
  --accent-soft: #e8f1ff;
  --danger: #b42318;
  --shadow: 0 16px 38px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.workspace {
  display: grid;
  grid-template-rows: minmax(260px, auto) 1fr;
  gap: 20px;
  padding: 28px;
}

.answer-panel,
.source-panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 154px;
  padding: 12px;
  line-height: 1.6;
}

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

.primary-button,
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
}

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

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.quick-item {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  color: #344054;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.answer-content pre,
.answer-empty pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.72;
  font-family: inherit;
}

.answer-empty {
  padding: 24px;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
}

.source-list {
  display: grid;
  gap: 12px;
}

.source-card {
  padding: 16px;
  border-radius: 8px;
  background: #fbfcfe;
  border: 1px solid var(--line);
}

.source-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

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

.source-page {
  flex: none;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.source-text {
  color: #344054;
  line-height: 1.72;
}

.fatal-error {
  padding: 24px;
  color: var(--danger);
}

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

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

  .workspace {
    padding: 18px;
  }
}
