:root {
  --bg: #f3f8f4;
  --surface: #ffffff;
  --surface-2: #f6fbf7;
  --ink: #223026;
  --muted: #8b9b8f;
  --line: #dcecdf;
  --line-strong: #c7dfce;
  --blue: #249447;
  --blue-2: #1f8f45;
  --cyan: #24a970;
  --green: #229847;
  --green-2: #1b7d3b;
  --amber: #a95c00;
  --red: #c13b2a;
  --nav: #f7fbf8;
  --nav-soft: #e6f4e9;
  --soft-blue: #eaf8f0;
  --soft-green: #e8f7eb;
  --soft-amber: #fff5e5;
  --soft-red: #fff0ee;
  --shadow: 0 18px 45px rgba(26, 104, 54, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 360px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  color: var(--ink);
  background: var(--nav);
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid #dfece3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #2daa52, #1f9144);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(34, 152, 71, 0.22);
}

.brand strong {
  display: block;
}

.brand strong {
  font-size: 19px;
  line-height: 1.1;
}

.login-panel,
.health {
  padding: 18px;
  border: 1px solid #d9eadc;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  color: #839287;
  font-size: 13px;
  font-weight: 800;
}

.login-panel select,
.text-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-panel select {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  font-size: 17px;
  font-weight: 900;
}

.login-panel .primary {
  width: 100%;
  margin-top: 18px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 16px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-group-title {
  margin: 18px 0 4px 6px;
  color: #8b9b8f;
  font-size: 13px;
  font-weight: 800;
}

.nav-group-title:first-child {
  margin-top: 0;
}

.nav-item {
  height: 48px;
  border-radius: 12px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #425047;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #536159;
  background: transparent;
  font-size: 19px;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: var(--green-2);
  background: var(--nav-soft);
}

.nav-item.active span {
  color: var(--green-2);
  background: transparent;
}

.health {
  margin-top: auto;
  display: grid;
  gap: 14px;
  border-radius: 0;
  border-width: 1px 0 0;
  padding: 18px 6px 0;
  background: transparent;
}

.health div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.health span {
  color: #8c9b90;
}

.health strong {
  color: #3d4b41;
}

.main {
  min-width: 0;
  padding: 0 28px 28px;
  background: var(--bg);
}

.topbar {
  display: none;
}

.eyebrow {
  display: none;
}

.topbar h1 {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  font-size: 15px;
  line-height: 1.35;
}

.user-pill {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: #555;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.insight-strip div {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 252, 0.96));
  box-shadow: 0 14px 36px rgba(15, 32, 59, 0.07);
}

.insight-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.insight-strip strong {
  display: block;
  font-size: 22px;
}

.workspace-grid,
.content-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.86fr) minmax(560px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.chat-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.chat-head {
  display: none;
}

.chat-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.chat-head h2 {
  margin-bottom: 8px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
}

.assistant-orb {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(145deg, #245cff, #5f9aff);
  box-shadow: 0 18px 34px rgba(47, 107, 255, 0.22), inset 0 -8px 18px rgba(8, 29, 89, 0.2);
  font-size: 25px;
  font-weight: 950;
}

.chat-head .actions {
  position: absolute;
  top: 22px;
  right: 36px;
}

.chat-messages {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 0 min(34px, 3vw) 34px;
  background: var(--bg);
}

.chat-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  max-width: 100%;
}

.chat-message.user {
  justify-self: end;
  max-width: min(620px, 76%);
  grid-template-columns: minmax(0, 1fr) 42px;
}

.chat-message.user .avatar {
  grid-column: 2;
  grid-row: 1;
  color: #fff;
  background: var(--green);
}

.chat-message.user .message-body {
  grid-column: 1;
  grid-row: 1;
  background: #edf8f0;
  border-color: #c9e8d0;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--green-2);
  background: #e7f5eb;
  font-weight: 900;
  font-size: 12px;
}

.message-body {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(38, 111, 61, 0.05);
}

.message-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.message-content {
  display: grid;
  gap: 12px;
}

.message-content p {
  margin-bottom: 0;
  color: #34443a;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.quote-action { border: 0; padding: 0; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.quote-action:hover { color: var(--green-2); }
.quote-preview, .quoted-message { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-left: 3px solid var(--green); padding: 8px 12px; color: #526158; background: #f2f8f3; font-size: 12px; }
.quote-preview button { border: 0; color: var(--muted); background: transparent; font-size: 18px; cursor: pointer; }
.quoted-message { margin-bottom: 10px; }

.chunk-answer {
  color: #2e3f35;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-list span {
  max-width: 260px;
  overflow: hidden;
  border-radius: 999px;
  padding: 5px 9px;
  color: #34443a;
  background: #fff;
  box-shadow: inset 0 0 0 1px #cce6d3;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-composer {
  width: min(1120px, calc(100vw - 340px));
  margin: 0 auto 18px;
  border: 1px solid #cbe8d1;
  border-radius: 18px;
  padding: 18px 22px 20px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(37, 126, 62, 0.08);
  align-self: end;
  position: relative;
  z-index: 5;
}

.intent-switch {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.intent {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 22px;
  color: #46554b;
  background: transparent;
  font-size: 15px;
  font-weight: 900;
}

.intent.active {
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(34, 152, 71, 0.22);
}

.chat-input-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 12px;
  align-items: center;
  border: 1px solid #d7eadb;
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.chat-input-row textarea {
  min-height: 54px;
  max-height: 160px;
  resize: vertical;
  border: 0;
  padding: 9px 6px;
  font-size: 17px;
  line-height: 1.55;
  box-shadow: none;
}

.chat-input-row textarea:focus {
  border: 0;
  box-shadow: none;
}

.attach-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0;
  border: 0;
  color: transparent;
  background: transparent url("./assets/btn-add-file.svg") center / 32px 32px no-repeat;
  font-size: 0;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  align-self: center;
  overflow: hidden;
  text-indent: -999px;
}

.attach-button:hover {
  background-image: url("./assets/btn-add-file-hover.svg");
}

.send-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  background: transparent url("./assets/btn-send.svg") center / 32px 32px no-repeat;
  box-shadow: 0 4px 10px rgba(30, 142, 62, 0.25);
  font-size: 0;
  line-height: 0;
  position: relative;
  flex: 0 0 32px;
  align-self: center;
}

.send-button::after {
  content: none;
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 14px;
  height: 14px;
  margin: 0;
  border-top: 3.5px solid #fff;
  border-left: 3.5px solid #fff;
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center;
}

.send-button:hover:not(:disabled) {
  background-image: url("./assets/btn-send-hover.svg");
}

.send-button:disabled {
  opacity: 1;
}

.send-button.is-loading::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 3px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.send-button.is-loading {
  background: var(--green);
}

.hidden-input {
  display: none;
}

.file-list.compact {
  margin: 0 0 10px;
}

.composer,
.result-panel,
.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.composer,
.panel {
  padding: 20px;
}

.result-panel {
  min-height: 620px;
  padding: 20px;
}

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

.section-head p,
.muted {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.55;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 16px;
  border: 1px solid #e5eaf1;
  border-radius: 8px;
  background: #eef2f7;
}

.mode {
  height: 38px;
  border-radius: 7px;
  color: #5d6b7e;
  background: transparent;
  font-weight: 900;
}

.mode.active {
  color: var(--green-2);
  background: #fff;
  box-shadow: 0 8px 20px rgba(34, 152, 71, 0.1);
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 226px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  line-height: 1.65;
  outline: none;
}

textarea.small {
  min-height: 152px;
}

textarea:focus,
.text-input:focus,
.login-panel select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 152, 71, 0.12);
}

.upload-zone {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  margin: 14px 0;
  background: var(--surface-2);
}

.upload-zone input {
  width: 100%;
  min-width: 0;
}

.upload-zone strong,
.upload-zone span {
  display: block;
}

.upload-zone strong {
  margin-bottom: 4px;
}

.upload-zone span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.file-list,
.impact-list,
.case-list,
.source-list,
.knowledge-list,
.history-list {
  display: grid;
  gap: 10px;
}

.file-list {
  margin-bottom: 14px;
}

.file-item,
.knowledge-card,
.history-card,
.finding,
.source-card,
.case-card,
.impact-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.file-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.primary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 900;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.small-button {
  min-height: 34px;
  border-radius: 9px;
  padding: 0 12px;
  font-size: 13px;
}

.primary {
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(34, 152, 71, 0.18);
}

.primary:hover {
  background: var(--green-2);
  box-shadow: 0 12px 24px rgba(34, 152, 71, 0.22);
}

.primary:disabled {
  color: #e8eef7;
  background: #a7b9ad;
  box-shadow: none;
}

.primary.send-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 8px;
  padding: 0;
  color: transparent;
  background: transparent url("./assets/btn-send.svg") center / 32px 32px no-repeat;
  box-shadow: 0 4px 10px rgba(30, 142, 62, 0.25);
}

.primary.send-button:hover:not(:disabled) {
  background-image: url("./assets/btn-send-hover.svg");
  box-shadow: 0 12px 24px rgba(34, 152, 71, 0.24);
}

.primary.send-button:disabled {
  color: transparent;
  background: transparent url("./assets/btn-send.svg") center / 32px 32px no-repeat;
  box-shadow: none;
}

.primary.send-button.is-loading,
.primary.send-button.is-loading:disabled {
  background: var(--green);
}

.large {
  width: 100%;
  height: 46px;
}

.ghost {
  color: #5d6b62;
  background: #edf6ef;
}

.ghost:hover:not(:disabled) {
  background: #e1f2e5;
  box-shadow: inset 0 0 0 1px #c9e8d0;
}

.ghost:disabled {
  color: #9aa7a0;
  background: #eef3ef;
}

.danger {
  color: #b42318;
  background: #fff4f1;
  border: 1px solid #ffd6cd;
}

.danger:hover:not(:disabled) {
  background: #ffe7e0;
}

.danger:disabled {
  color: #b8a3a0;
  background: #f5f5f5;
  border-color: #eeeeee;
}

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

.actions.left {
  justify-content: flex-start;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  min-height: 474px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  max-width: 460px;
  line-height: 1.7;
}

.empty-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  color: var(--green-2);
  background: linear-gradient(135deg, #e8f7eb, #f8fcf9);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #cde8d4, 0 15px 34px rgba(34, 152, 71, 0.08);
}

.hidden {
  display: none;
}

.result-content {
  display: grid;
  gap: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-2);
}

.metric strong {
  display: block;
  margin-bottom: 2px;
  font-size: 25px;
  line-height: 1;
}

.metric span,
.tag,
.meta {
  color: var(--muted);
  font-size: 12px;
}

.finding {
  display: grid;
  gap: 12px;
  border-color: #d8eadc;
  border-left: 5px solid var(--green);
  padding: 20px 22px;
  box-shadow: 0 12px 26px rgba(30, 104, 55, 0.05);
}

.finding-head,
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.badge {
  flex: 0 0 auto;
  max-width: 220px;
  border-radius: 8px;
  padding: 5px 10px;
  color: #344054;
  background: #edf0f4;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge.high {
  color: var(--red);
  background: var(--soft-red);
}

.badge.medium {
  color: var(--amber);
  background: var(--soft-amber);
}

.badge.low {
  color: var(--green);
  background: var(--soft-green);
  border: 1px solid #c9e8d0;
}

.tabs-title {
  margin: 4px 0 10px;
}

.case-card p,
.finding p,
.source-card p,
.impact-row p,
.knowledge-card p,
.history-card p {
  margin-bottom: 6px;
  color: #405046;
  line-height: 1.6;
}

.finding p strong {
  color: var(--green-2);
}

.reference-box {
  border-radius: 12px;
  padding: 10px 12px;
  background: #f7fbf8;
  border: 1px solid var(--line);
}

.reference-box blockquote {
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 3px solid #b9dfc2;
  color: #405046;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list span {
  border-radius: 999px;
  padding: 6px 10px;
  background: #e8f7eb;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 8px;
  padding-left: 22px;
}

.question-list li {
  color: #34443a;
  line-height: 1.6;
}

.knowledge-card {
  display: grid;
  gap: 8px;
}

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

.knowledge-log-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.knowledge-log-card p {
  margin: 8px 0;
  color: #344054;
  line-height: 1.6;
}

.knowledge-workflow {
  display: grid;
  gap: 16px;
}

.knowledge-upload-panel {
  display: grid;
  gap: 4px;
}

.knowledge-upload-grid {
  display: grid;
  grid-template-columns: 1fr 220px 280px;
  gap: 14px;
  align-items: end;
}

.file-input {
  padding-top: 8px;
}

.knowledge-preview-panel {
  min-height: 430px;
}

.chunk-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chunk-stats span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: #465467;
  background: #edf2f7;
  font-size: 12px;
  font-weight: 900;
}

.chunk-stats .high {
  color: var(--red);
  background: var(--soft-red);
}

.chunk-stats .medium {
  color: var(--amber);
  background: var(--soft-amber);
}

.chunk-stats .low {
  color: var(--green);
  background: var(--soft-green);
}

.chunk-preview {
  max-height: 560px;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 6px;
}

.empty-preview {
  min-height: 300px;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-preview p {
  margin-bottom: 0;
}

.chunk-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.chunk-card p {
  margin-bottom: 0;
  color: #34443a;
  line-height: 1.65;
  white-space: pre-wrap;
}

.chunk-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chunk-kv {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
}

.field-name,
.field-value {
  display: block;
}

.field-name {
  margin-bottom: 4px;
  color: #6f8274;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.field-value {
  color: #2e3f35;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.chunk-field {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.chunk-field h4 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 11px;
  color: #34443a;
  background: var(--surface-2);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chunk-card details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.chunk-card summary {
  padding: 9px 11px;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.chunk-card pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 11px;
  color: #34443a;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.knowledge-confirm-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.knowledge-confirm-panel p {
  margin-bottom: 0;
}

.empty-list {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #f8fcf9;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 420px;
  border-radius: 12px;
  padding: 13px 15px;
  color: #fff;
  background: #1e3326;
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr 260px;
  }

  .nav,
  .health {
    grid-column: 1 / -1;
  }

  .workspace-grid,
  .content-grid,
  .knowledge-upload-grid {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    height: auto;
    min-height: calc(100vh - 260px);
  }

  .chat-composer {
    width: 100%;
    margin-bottom: 0;
  }

  .chat-head .actions {
    position: static;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .sidebar,
  .insight-strip {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .finding-head,
  .card-head {
    flex-direction: column;
  }

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

  .mode-switch,
  .upload-zone {
    grid-template-columns: 1fr;
  }

  .chat-head {
    min-height: 0;
  }

  .chat-head h2 {
    font-size: 36px;
  }

  .chat-messages {
    padding: 12px 0 18px;
  }

  .chat-message.user {
    max-width: 92%;
  }

  .chat-input-row {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    padding: 10px;
  }

  .send-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    flex-basis: 32px;
  }

  .primary.send-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .knowledge-confirm-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .chunk-field-grid {
    grid-template-columns: 1fr;
  }
}
