:root {
  --canvas: #f4f6f2;
  --paper: #ffffff;
  --paper-soft: #f9faf7;
  --ink: #17211e;
  --muted: #68746f;
  --faint: #929c97;
  --line: #dde3de;
  --line-strong: #cbd3cd;
  --green-950: #153b32;
  --green-800: #24594c;
  --green-650: #347565;
  --green-100: #e5efea;
  --green-50: #f1f6f3;
  --orange: #b85c25;
  --orange-soft: #fbefe7;
  --blue: #345f8e;
  --blue-soft: #edf3fa;
  --red: #a64438;
  --red-soft: #faece9;
  --shadow: 0 14px 38px rgba(30, 53, 45, 0.08);
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  display: grid;
  grid-template-columns: 280px minmax(340px, 1fr) 280px;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-950);
  font-size: 18px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.primary-nav {
  height: 100%;
  display: flex;
  justify-content: center;
  gap: 34px;
}

.nav-link {
  position: relative;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.nav-link.active {
  color: var(--green-950);
  font-weight: 700;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 0;
  left: 4px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--green-650);
}

.nav-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 9px;
  place-items: center;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.text-action,
.icon-button,
.profile-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.text-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--green-800);
  font-size: 13px;
}

.text-action:hover {
  background: var(--green-50);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
}

.icon-button:hover {
  background: var(--green-50);
  color: var(--green-950);
}

.icon-button.small {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.profile-button {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.profile-button span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-800);
  font-size: 12px;
  font-weight: 700;
}

.mode-strip {
  min-height: 46px;
  padding: 6px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.mode-switch {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #edf1ed;
  display: flex;
}

.mode-button {
  border: 0;
  border-radius: 6px;
  padding: 7px 13px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.mode-button i {
  margin-right: 5px;
}

.mode-button.active {
  background: var(--paper);
  color: var(--green-950);
  box-shadow: 0 1px 4px rgba(27, 48, 41, 0.12);
  font-weight: 700;
}

.mode-button[data-mode="online"].active {
  color: var(--orange);
}

.mode-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-note i {
  margin-right: 5px;
  color: var(--green-650);
}

.query-workspace {
  width: 100%;
  min-height: calc(100vh - 114px);
  display: grid;
  grid-template-columns: 286px minmax(560px, 1fr) 330px;
}

.source-column,
.evidence-column {
  min-width: 0;
  background: var(--paper);
}

.source-column {
  border-right: 1px solid var(--line);
}

.evidence-column {
  border-left: 1px solid var(--line);
}

.column-heading,
.evidence-heading {
  height: 76px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.column-heading h2,
.evidence-heading h2,
.evidence-sheet h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.column-heading h2 span {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 11px;
  place-items: center;
  color: var(--green-650);
  background: var(--green-100);
  font-size: 11px;
}

.source-search {
  margin: 14px 16px 10px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  background: var(--paper-soft);
}

.source-search:focus-within {
  border-color: var(--green-650);
  box-shadow: 0 0 0 3px rgba(52, 117, 101, 0.1);
}

.source-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.source-filters {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 5px;
}

.source-filter {
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 5px 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.source-filter.active {
  border-color: #c8d8d0;
  color: var(--green-800);
  background: var(--green-50);
  font-weight: 700;
}

.source-list {
  height: calc(100vh - 252px);
  min-height: 440px;
  overflow: auto;
}

.source-card {
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}

.source-card:hover {
  background: var(--paper-soft);
}

.source-card.active {
  box-shadow: inset 3px 0 var(--green-650);
  background: var(--green-50);
}

.source-card-top {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--paper);
  background: var(--green-800);
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
}

.source-kind {
  color: var(--green-650);
  font-size: 10px;
  font-weight: 700;
}

.source-level {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 9px;
}

.source-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.48;
}

.source-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-card-meta {
  margin-top: 9px;
  color: var(--faint);
  font-size: 10px;
}

.empty-sources {
  padding: 28px 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.answer-column {
  min-width: 0;
  padding: 28px clamp(26px, 4vw, 66px) 50px;
  background: var(--canvas);
}

.query-composer {
  max-width: 790px;
  margin: 0 auto 22px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(29, 54, 45, 0.06);
}

.query-composer:focus-within {
  border-color: var(--green-650);
  box-shadow: 0 0 0 3px rgba(52, 117, 101, 0.09), var(--shadow);
}

.composer-main {
  min-height: 62px;
  padding: 15px 14px 9px 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.composer-icon {
  color: var(--green-650);
  font-size: 20px;
}

.composer-main textarea {
  width: 100%;
  min-height: 28px;
  max-height: 100px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  line-height: 1.55;
}

.ask-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-950);
  font-size: 18px;
  cursor: pointer;
}

.ask-button:hover {
  background: var(--green-800);
}

.ask-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.composer-footer {
  min-height: 35px;
  padding: 7px 14px 8px 48px;
  border-top: 1px solid #edf0ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 10px;
}

.composer-footer button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.advanced-panel {
  max-width: 790px;
  margin: -12px auto 22px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.advanced-panel:not([hidden]) {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.advanced-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.advanced-panel select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 28px 0 9px;
  background: white;
  color: var(--ink);
  font-size: 11px;
}

.advanced-panel button {
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--green-650);
  font-size: 11px;
  cursor: pointer;
}

.result-view-tabs {
  max-width: 790px;
  margin: 0 auto 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 22px;
}

.result-view-tab {
  position: relative;
  min-height: 41px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.result-view-tab i {
  margin-right: 5px;
}

.result-view-tab span {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 9px;
  place-items: center;
  background: #e8ece8;
  font-size: 9px;
}

.result-view-tab.active {
  color: var(--green-950);
  font-weight: 700;
}

.result-view-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--green-650);
}

.discovery-panel {
  max-width: 790px;
  margin: 0 auto;
}

.discovery-header {
  padding: 14px 2px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.discovery-kicker {
  margin: 0 0 5px;
  color: var(--green-650);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.discovery-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
}

.discovery-header > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.research-cta {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid #bfd0c8;
  border-radius: 8px;
  color: var(--green-800);
  background: var(--paper);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.research-cta:hover {
  border-color: var(--green-650);
  background: var(--green-50);
}

.result-stats {
  margin-bottom: 12px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  align-items: center;
  gap: 18px;
}

.result-stats > div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.result-stats strong {
  color: var(--green-800);
  font-family: Georgia, serif;
  font-size: 17px;
}

.result-stats span {
  color: var(--muted);
  font-size: 10px;
}

.result-stats p {
  margin: 0;
  justify-self: end;
  color: var(--muted);
  font-size: 10px;
}

.result-stats p i {
  margin-right: 4px;
  color: var(--green-650);
}

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

.discovery-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 6px 18px rgba(29, 54, 45, 0.04);
  overflow: hidden;
}

.discovery-card.speech-card {
  border-color: #d9d5c6;
}

.discovery-card-header {
  padding: 17px 18px 14px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.result-order {
  padding-top: 2px;
  color: var(--green-650);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
}

.result-meta-line {
  margin-bottom: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--faint);
  font-size: 9px;
}

.result-type {
  color: var(--green-650);
  font-weight: 700;
}

.speech-card .result-type {
  color: #7a6540;
}

.result-title-wrap h2 {
  margin: 0 0 7px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
}

.effect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 11px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.open-document {
  padding: 5px 7px;
  color: var(--green-650);
  text-decoration: none;
  font-size: 10px;
  white-space: nowrap;
}

.match-group {
  padding: 11px 18px 15px 60px;
  border-top: 1px solid #edf0ed;
  background: var(--paper-soft);
}

.match-group-title {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.match-group-title i {
  color: var(--green-650);
}

.match-row {
  width: 100%;
  min-height: 42px;
  margin-top: 5px;
  padding: 8px 8px 8px 10px;
  border: 1px solid #e1e7e2;
  border-radius: 7px;
  background: var(--paper);
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.match-row:hover {
  border-color: #b9ccc2;
  background: var(--green-50);
}

.match-location {
  color: var(--green-800);
  font-size: 10px;
  font-weight: 700;
}

.match-location i {
  margin-right: 3px;
}

.match-text {
  display: -webkit-box;
  overflow: hidden;
  color: #4f5c58;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.match-arrow {
  color: var(--faint);
}

.expand-matches {
  margin-top: 7px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--green-650);
  font-size: 9px;
  cursor: pointer;
}

.discovery-empty {
  padding: 70px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.discovery-empty i {
  color: var(--green-650);
  font-size: 28px;
}

.discovery-empty h3 {
  margin: 12px 0 4px;
  color: var(--ink);
  font-size: 14px;
}

.discovery-empty p {
  margin: 0;
  font-size: 11px;
}

.answer-card {
  max-width: 790px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.answer-header {
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.answer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--green-800);
  background: var(--green-100);
}

.answer-header p {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
}

.answer-header span {
  color: var(--faint);
  font-size: 10px;
}

.answer-content {
  padding: 25px 29px 8px;
}

.conclusion-block {
  margin-bottom: 28px;
  padding: 18px 20px;
  border-left: 3px solid var(--green-650);
  background: var(--green-50);
}

.section-label {
  margin: 0 0 8px !important;
  color: var(--green-650) !important;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.conclusion-block > p:last-child {
  margin: 0;
  color: #263d36;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.8;
}

.answer-section {
  margin-bottom: 28px;
}

.answer-section h3 {
  margin: 0 0 11px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
}

.answer-section h3 span {
  margin-right: 8px;
  color: var(--green-650);
  font-family: Georgia, serif;
  font-size: 11px;
}

.answer-section > p {
  margin: 0;
  color: #43504c;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.94;
}

.citation-chip {
  width: 20px;
  height: 20px;
  margin: 0 2px;
  padding: 0;
  border: 1px solid #bfd0c8;
  border-radius: 50%;
  color: var(--green-800);
  background: var(--green-50);
  vertical-align: 2px;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.citation-chip:hover,
.citation-chip.active {
  color: white;
  background: var(--green-800);
}

.implication {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 7px;
  background: #f7f8f5;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  font-size: 11px;
  line-height: 1.65;
}

.implication strong {
  color: var(--green-650);
}

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

.action-grid {
  margin: 2px 0 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.action-grid > div {
  min-width: 0;
  padding: 14px;
}

.action-grid > div + div {
  border-left: 1px solid var(--line);
}

.action-label {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
}

.action-label.opportunity {
  color: var(--green-800);
  background: var(--green-100);
}

.action-label.risk {
  color: var(--red);
  background: var(--red-soft);
}

.action-label.action {
  color: var(--blue);
  background: var(--blue-soft);
}

.action-grid p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.answer-footer {
  min-height: 48px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.answer-footer button {
  border: 0;
  padding: 6px 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.answer-footer span {
  color: var(--faint);
  font-size: 9px;
}

.followup-row {
  max-width: 790px;
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  color: var(--faint);
  font-size: 10px;
  scrollbar-width: none;
}

.followup-row::-webkit-scrollbar {
  display: none;
}

.followup-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 7px 10px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.followup-chip:hover {
  border-color: var(--green-650);
  color: var(--green-800);
}

.loading-state {
  min-height: 320px;
  padding-top: 118px;
  text-align: center;
}

.loading-state span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--green-650);
  animation: pulse 0.9s infinite alternate;
}

.loading-state span:nth-child(2) {
  animation-delay: 0.18s;
}

.loading-state span:nth-child(3) {
  animation-delay: 0.36s;
}

.loading-state p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@keyframes pulse {
  to {
    opacity: 0.25;
    transform: translateY(-4px);
  }
}

.evidence-body {
  padding: 24px 22px;
}

.evidence-number {
  width: 28px;
  height: 28px;
  margin-bottom: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-800);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.evidence-type {
  margin: 0 0 7px;
  color: var(--green-650);
  font-size: 10px;
  font-weight: 700;
}

.evidence-body h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

.evidence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}

.location-bar {
  margin: 23px 0 10px;
  color: var(--green-800);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.evidence-body blockquote {
  margin: 0;
  padding: 16px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  color: #33433e;
  background: var(--green-50);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.86;
}

.evidence-body mark,
.evidence-sheet mark {
  padding: 1px 2px;
  color: inherit;
  background: #f4e6ab;
}

.match-reason {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.match-reason i {
  margin-right: 5px;
  color: var(--green-650);
}

.evidence-actions {
  margin-top: 24px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.evidence-actions button {
  border: 0;
  padding: 5px 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.source-link {
  margin-top: 18px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--green-800);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}

.source-link:hover {
  border-color: var(--green-650);
  background: var(--green-50);
}

.mobile-evidence-trigger,
.evidence-sheet,
.sheet-backdrop {
  display: none;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: 320px;
  padding: 11px 15px;
  border-radius: 8px;
  color: white;
  background: var(--green-950);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-header {
    grid-template-columns: 240px 1fr 210px;
  }

  .query-workspace {
    grid-template-columns: 250px minmax(520px, 1fr) 290px;
  }

  .answer-column {
    padding-right: 28px;
    padding-left: 28px;
  }

  .text-action span {
    display: none;
  }
}

@media (max-width: 940px) {
  .app-header {
    padding: 0 18px;
    grid-template-columns: 1fr auto;
  }

  .primary-nav {
    display: none;
  }

  .query-workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .evidence-column {
    display: none;
  }
}

@media (max-width: 700px) {
  body {
    padding-bottom: 65px;
  }

  .app-header {
    height: 58px;
    padding: 0 15px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 8px;
    font-size: 16px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    display: none;
  }

  .header-actions {
    gap: 0;
  }

  .text-action {
    padding: 8px;
  }

  .text-action span,
  #helpButton,
  .profile-button i {
    display: none;
  }

  .profile-button {
    margin-left: 0;
  }

  .profile-button span {
    width: 29px;
    height: 29px;
  }

  .mode-strip {
    min-height: 49px;
    padding: 7px 13px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .mode-switch {
    width: 100%;
    flex: 0 0 auto;
  }

  .mode-button {
    flex: 1;
    padding: 7px 8px;
    white-space: nowrap;
  }

  .mode-note {
    display: none;
  }

  .query-workspace {
    min-height: calc(100vh - 107px);
    display: block;
  }

  .source-column {
    display: none;
  }

  .answer-column {
    padding: 14px 12px 28px;
  }

  .query-composer {
    margin-bottom: 13px;
    border-radius: 12px;
  }

  .composer-main {
    min-height: 56px;
    padding: 12px 10px 8px 13px;
    gap: 8px;
  }

  .composer-icon {
    font-size: 17px;
  }

  .composer-main textarea {
    font-size: 14px;
    line-height: 1.5;
  }

  .ask-button {
    width: 35px;
    height: 35px;
  }

  .composer-footer {
    min-height: 32px;
    padding: 6px 11px 7px 38px;
  }

  .composer-footer span {
    max-width: 225px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .composer-footer button {
    font-size: 0;
  }

  .composer-footer button i {
    font-size: 14px;
  }

  .advanced-panel {
    margin-top: -4px;
    flex-wrap: wrap;
  }

  .result-view-tabs {
    margin-bottom: 6px;
    gap: 15px;
    overflow-x: auto;
  }

  .result-view-tab {
    flex: 0 0 auto;
    font-size: 11px;
  }

  .discovery-header {
    padding-top: 12px;
    display: block;
  }

  .discovery-header h1 {
    font-size: 19px;
  }

  .research-cta {
    width: 100%;
    margin-top: 12px;
  }

  .result-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .result-stats > div {
    justify-content: center;
  }

  .result-stats p {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .discovery-card-header {
    padding: 14px 13px 12px;
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .open-document {
    grid-column: 2;
    justify-self: start;
    padding-left: 0;
  }

  .result-title-wrap h2 {
    font-size: 15px;
  }

  .match-group {
    padding: 10px 12px 13px;
  }

  .match-row {
    padding: 9px;
    grid-template-columns: 1fr 15px;
  }

  .match-location {
    grid-column: 1;
  }

  .match-text {
    grid-column: 1;
    -webkit-line-clamp: 3;
  }

  .match-arrow {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .answer-card {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(30, 53, 45, 0.06);
  }

  .answer-header {
    padding: 13px 15px;
  }

  .answer-avatar {
    width: 31px;
    height: 31px;
  }

  .answer-content {
    padding: 17px 16px 4px;
  }

  .conclusion-block {
    margin-bottom: 23px;
    padding: 14px 15px;
  }

  .conclusion-block > p:last-child {
    font-size: 15px;
    line-height: 1.75;
  }

  .answer-section {
    margin-bottom: 23px;
  }

  .answer-section h3 {
    font-size: 15px;
  }

  .answer-section > p {
    font-size: 13px;
    line-height: 1.88;
  }

  .implication {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .action-grid > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .answer-footer {
    padding: 8px 10px;
  }

  .answer-footer span {
    display: none;
  }

  .followup-row {
    margin-top: 14px;
    padding-bottom: 4px;
  }

  .followup-row > span {
    display: none;
  }

  .mobile-evidence-trigger {
    position: fixed;
    z-index: 48;
    right: 12px;
    bottom: 12px;
    left: 12px;
    height: 47px;
    padding: 0 16px;
    border: 1px solid #2b6656;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    background: var(--green-950);
    box-shadow: 0 12px 28px rgba(18, 53, 44, 0.24);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-evidence-trigger strong {
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--green-950);
    background: white;
    font-family: Georgia, serif;
    font-size: 11px;
  }

  .sheet-backdrop {
    position: fixed;
    z-index: 60;
    inset: 0;
    background: rgba(15, 28, 24, 0.42);
  }

  .sheet-backdrop:not([hidden]) {
    display: block;
  }

  .evidence-sheet {
    position: fixed;
    z-index: 65;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 78vh;
    padding: 8px 18px 24px;
    border-radius: 18px 18px 0 0;
    background: var(--paper);
    box-shadow: 0 -18px 50px rgba(15, 34, 27, 0.2);
    overflow-y: auto;
    transform: translateY(105%);
    transition: transform 220ms ease;
  }

  .evidence-sheet.open {
    display: block;
    transform: translateY(0);
  }

  .sheet-handle {
    width: 38px;
    height: 4px;
    margin: 1px auto 12px;
    border-radius: 4px;
    background: #d7ddd9;
  }

  .evidence-sheet header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .evidence-sheet .evidence-body {
    padding: 18px 0 0;
  }

  .toast {
    right: 12px;
    bottom: 70px;
    left: 12px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Authenticated product surfaces */
[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  padding: 42px clamp(22px, 7vw, 100px);
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 520px);
  align-items: center;
  gap: clamp(40px, 10vw, 150px);
  color: white;
  background:
    radial-gradient(circle at 18% 18%, rgba(111, 171, 149, 0.22), transparent 30%),
    radial-gradient(circle at 84% 82%, rgba(216, 150, 92, 0.13), transparent 26%),
    linear-gradient(135deg, #102f28 0%, #173c33 52%, #0f2923 100%);
}

.login-brand {
  align-self: start;
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand .brand-mark {
  width: 42px;
  height: 42px;
  color: var(--green-950);
  background: #f0f7f3;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 20px;
  letter-spacing: 0.08em;
}

.login-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.login-card {
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(4, 18, 14, 0.3);
}

.login-intro {
  margin-bottom: 30px;
}

.login-intro h1 {
  margin: 8px 0 12px;
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 40px);
  line-height: 1.24;
  letter-spacing: 0.01em;
}

.login-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.login-card label,
.app-dialog label {
  margin-top: 16px;
  display: grid;
  gap: 7px;
  color: #43504b;
  font-size: 12px;
  font-weight: 700;
}

.login-card input,
.app-dialog input,
.app-dialog textarea,
.app-dialog select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: white;
  outline: 0;
  font-size: 13px;
  font-weight: 400;
}

.login-card input {
  height: 48px;
}

.login-card input:focus,
.app-dialog input:focus,
.app-dialog textarea:focus,
.app-dialog select:focus {
  border-color: var(--green-650);
  box-shadow: 0 0 0 3px rgba(52, 117, 101, 0.1);
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: white;
  background: var(--green-950);
}

.primary-button:hover {
  background: var(--green-800);
}

.secondary-button {
  border-color: var(--line-strong);
  color: var(--green-800);
  background: white;
}

.secondary-button:hover {
  background: var(--green-50);
}

.wide {
  width: 100%;
  height: 50px;
  margin-top: 24px;
}

.login-footnote,
.field-help {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.form-error {
  margin: 11px 0 0;
  color: var(--red);
  font-size: 12px;
}

.header-actions {
  position: relative;
}

.profile-menu {
  position: absolute;
  z-index: 60;
  top: 48px;
  right: 0;
  width: 210px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
}

.profile-menu strong,
.profile-menu > span {
  display: block;
}

.profile-menu strong {
  font-size: 13px;
}

.profile-menu > span {
  margin: 3px 0 11px;
  color: var(--faint);
  font-size: 10px;
}

.profile-menu button {
  width: 100%;
  padding: 9px 7px;
  border: 0;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.profile-menu button:hover {
  color: var(--green-950);
  background: var(--green-50);
}

.app-view {
  min-height: calc(100vh - 68px);
}

.collection-view {
  max-width: 1280px;
  margin: 0 auto;
  padding: 38px clamp(22px, 5vw, 68px) 70px;
}

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

.page-heading h1 {
  margin: 5px 0 8px;
  font-family: var(--serif);
  font-size: 30px;
}

.page-heading > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-search {
  width: min(310px, 32vw);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  background: white;
}

.compact-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.library-toolbar {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.document-table,
.user-table,
.candidate-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: white;
  box-shadow: 0 8px 28px rgba(30, 53, 45, 0.04);
}

.table-row {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(300px, 1.5fr) minmax(150px, 0.7fr) 120px 120px auto;
  align-items: center;
  gap: 18px;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row:hover {
  background: var(--green-50);
}

.table-main strong,
.table-main span {
  display: block;
}

.table-main strong {
  margin-bottom: 5px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
}

.table-main span,
.table-cell {
  color: var(--muted);
  font-size: 11px;
}

.table-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-tags span,
.status-pill,
.recommendation-pill {
  padding: 4px 7px;
  border-radius: 5px;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 9px;
  font-weight: 700;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.row-actions button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.row-actions button:hover {
  border-color: var(--line);
  color: var(--green-950);
  background: white;
}

.scan-status {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.scan-status > div {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.scan-status span,
.scan-status strong {
  display: block;
}

.scan-status span {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 10px;
}

.scan-status strong {
  font-size: 13px;
}

.candidate-card {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 170px;
  align-items: start;
  gap: 18px;
}

.candidate-card:last-child {
  border-bottom: 0;
}

.candidate-score {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--green-950);
  background: conic-gradient(var(--green-650) var(--score), var(--green-100) 0);
  box-shadow: inset 0 0 0 8px white;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
}

.candidate-content h2 {
  margin: 5px 0 8px;
  font-family: var(--serif);
  font-size: 17px;
}

.candidate-content p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.candidate-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--faint);
  font-size: 10px;
}

.candidate-actions {
  display: grid;
  gap: 8px;
}

.candidate-actions .primary-button,
.candidate-actions .secondary-button {
  width: 100%;
}

.recommendation-pill.ignore {
  color: var(--muted);
  background: #eff1ef;
}

.admin-summary {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.admin-summary article {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.admin-summary article > span {
  color: var(--faint);
  font-size: 10px;
}

.admin-summary strong {
  margin: 10px 0 7px;
  display: block;
  font-family: var(--serif);
  font-size: 18px;
}

.admin-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.admin-summary article > div {
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--green-100);
}

.admin-summary article > div i {
  width: 0;
  height: 100%;
  display: block;
  background: var(--green-650);
}

.system-health-notice {
  margin: -4px 0 20px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #e9cf8a;
  border-radius: 12px;
  background: #fff9e8;
  color: #624a13;
}

.system-health-notice.danger {
  border-color: #e2aaa4;
  background: #fff1ef;
  color: #7a2c25;
}

.system-health-notice > i {
  margin-top: 2px;
  font-size: 20px;
}

.system-health-notice strong,
.system-health-notice p {
  display: block;
  margin: 0;
}

.system-health-notice p {
  margin-top: 4px;
  font-size: 12px;
}

.learning-view {
  max-width: 1280px;
  margin: 0 auto;
  padding: 38px clamp(22px, 5vw, 68px) 76px;
}

.learning-heading {
  align-items: flex-end;
}

.learning-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.learning-filters label,
.research-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.learning-filters select,
.research-controls select,
.research-controls input {
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: white;
  font-size: 12px;
}

.learning-stats {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.learning-stats article {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
}

.learning-stats article > i {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 18px;
}

.learning-stats strong,
.learning-stats span {
  display: block;
}

.learning-stats strong {
  font-family: Georgia, var(--serif);
  font-size: 23px;
}

.learning-stats span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.learning-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.learning-pagination {
  padding-top: 22px;
  display: flex;
  justify-content: center;
}

.learning-card {
  min-height: 272px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  background: white;
  box-shadow: 0 8px 28px rgba(30, 53, 45, 0.04);
}

.learning-card:hover {
  border-color: #b8c9c0;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.learning-card-top,
.learning-card-meta,
.learning-card-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.learning-card-top {
  justify-content: space-between;
}

.learning-kind,
.learning-badge {
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 9px;
  font-weight: 700;
}

.learning-badge.backfill {
  color: var(--blue);
  background: var(--blue-soft);
}

.learning-badge.consultation {
  color: var(--orange);
  background: var(--orange-soft);
}

.learning-card h2 {
  margin: 15px 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.5;
}

.learning-card-meta {
  color: var(--faint);
  font-size: 10px;
}

.learning-conclusion {
  margin: 17px 0;
  padding: 13px 15px;
  border-left: 3px solid var(--green-650);
  color: #394740;
  background: var(--green-50);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.75;
}

.learning-card-footer {
  margin-top: auto;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.learning-card-footer button {
  min-height: 38px;
}

.research-console {
  margin-bottom: 34px;
  padding: 24px;
  border: 1px solid #c9d8d0;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8fbf9 0%, #eef5f1 100%);
  box-shadow: 0 12px 34px rgba(30, 73, 59, 0.06);
}

.research-console-heading,
.research-console-heading > div,
.section-heading,
.research-result-heading,
.research-result-heading > div,
.research-progress > div:first-child,
.research-source-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.research-console-heading > div {
  justify-content: flex-start;
}

.research-console-heading h2,
.section-heading h2 {
  margin: 3px 0 5px;
  font-family: var(--serif);
  font-size: 22px;
}

.research-console-heading p,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.research-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-950);
  font-size: 21px;
}

.verified-pill {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green-800);
  background: white;
  font-size: 10px;
  font-weight: 700;
}

.research-controls {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) 170px;
  align-items: end;
  gap: 12px;
}

.research-source-heading {
  margin-top: 22px;
  font-size: 11px;
}

.research-sources {
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.research-source {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  font-size: 10px;
}

.research-source input {
  accent-color: var(--green-650);
}

.research-progress,
.research-result-heading {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.research-progress {
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  height: 7px;
  margin-top: 9px;
  border-radius: 5px;
  overflow: hidden;
  background: white;
}

.progress-track i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--green-650);
  transition: width 220ms ease;
}

.research-result-heading span {
  color: var(--muted);
  font-size: 10px;
}

.research-candidates {
  margin-top: 10px;
  display: grid;
  gap: 9px;
}

.backfill-console {
  margin-bottom: 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 30px rgba(30, 53, 45, 0.04);
}

.backfill-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.backfill-summary article {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  align-content: center;
  gap: 6px;
  background: var(--green-50);
}

.backfill-summary span,
.backfill-actions,
.backfill-source-meta {
  color: var(--muted);
  font-size: 10px;
}

.backfill-summary strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
}

.backfill-actions {
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.backfill-sources {
  display: grid;
  gap: 7px;
}

.backfill-source {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(5, minmax(58px, auto));
  align-items: center;
  gap: 10px;
}

.backfill-source > strong {
  font-size: 11px;
}

.backfill-source-stat {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 9px;
}

.backfill-source-stat b {
  color: var(--ink);
  font-size: 12px;
}

.backfill-source-error {
  grid-column: 1 / -1;
  color: #9a4b37;
  font-size: 10px;
}

.research-candidates .candidate-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.candidate-statuses {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.candidate-statuses span {
  padding: 4px 7px;
  border-radius: 5px;
  color: var(--muted);
  background: #eff2f0;
  font-size: 9px;
}

.candidate-statuses .verified {
  color: var(--green-800);
  background: var(--green-100);
}

.account-management {
  padding-top: 8px;
}

.section-heading {
  margin-bottom: 18px;
}

.learning-article {
  width: min(900px, calc(100% - 44px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.learning-interpretation {
  margin-bottom: 38px;
  padding: 28px;
  border: 1px solid #c9d8d0;
  border-radius: 14px;
  background: #f5faf7;
}

.learning-interpretation > header {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.learning-interpretation h2,
.learning-original h2 {
  margin: 4px 0;
  font-family: var(--serif);
  font-size: 24px;
}

.learning-interpretation h3 {
  margin: 24px 0 8px;
  color: var(--green-950);
  font-family: var(--serif);
  font-size: 18px;
}

.learning-interpretation p,
.learning-interpretation li {
  color: #304139;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.95;
}

.learning-original {
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.learning-original .reader-content {
  width: 100%;
  padding: 20px 0 0;
}

.learning-citation {
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  color: var(--green-800);
  background: var(--green-100);
  cursor: pointer;
}

.learning-reader-navigation {
  display: flex;
  gap: 8px;
}

.empty-panel {
  padding: 55px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-panel i {
  display: block;
  margin-bottom: 9px;
  color: var(--green-650);
  font-size: 28px;
}

.app-dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: white;
  box-shadow: 0 30px 90px rgba(14, 35, 28, 0.3);
}

.app-dialog::backdrop {
  background: rgba(12, 28, 23, 0.52);
  backdrop-filter: blur(2px);
}

.app-dialog > form {
  max-height: 90vh;
  padding: 22px;
  overflow: auto;
}

.app-dialog header,
.app-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-dialog header {
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.app-dialog h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 21px;
}

.app-dialog footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.compact-dialog {
  width: min(520px, calc(100vw - 28px));
}

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

.span-2 {
  grid-column: 1 / -1;
}

.file-label input {
  padding: 9px;
  background: var(--paper-soft);
}

.comment-panel {
  margin-top: 22px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper-soft);
}

.comment-panel-heading,
.comment-composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-panel h3 {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 16px;
}

.comment-panel select {
  width: 110px;
  margin: 0;
  padding: 7px;
}

.comment-list {
  margin: 13px 0;
  display: grid;
  gap: 8px;
}

.comment-item {
  padding: 10px 11px;
  border-radius: 8px;
  background: white;
}

.comment-item div {
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9px;
}

.comment-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.comment-composer textarea {
  min-height: 54px;
  margin: 0;
}

.answer-citation-row {
  width: 100%;
  height: auto;
  margin: 7px 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: grid;
  grid-template-columns: 25px 1fr;
  align-items: start;
  gap: 9px;
  color: var(--ink);
  background: var(--paper-soft);
  text-align: left;
}

.answer-citation-row b {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green-800);
  font-family: Georgia, serif;
  font-size: 10px;
}

.answer-citation-row span,
.answer-citation-row strong,
.answer-citation-row small,
.answer-citation-row em {
  display: block;
}

.answer-citation-row strong {
  font-family: var(--serif);
  font-size: 12px;
}

.answer-citation-row small {
  margin: 3px 0;
  color: var(--green-650);
  font-size: 9px;
}

.answer-citation-row em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.55;
}

.online-source-panel {
  margin: 22px 0;
  padding: 15px;
  border: 1px solid #e6bd98;
  border-radius: 10px;
  background: var(--orange-soft);
}

.online-source-panel > strong,
.online-source-panel > a {
  display: block;
}

.online-source-panel > p {
  color: #82573a;
  font-size: 11px;
}

.online-source-panel > a {
  margin-top: 6px;
  color: var(--blue);
  font-size: 11px;
  text-decoration: none;
}

.consultation-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #d9823a;
  border-radius: 999px;
  background: #fff3e8;
  color: #9a4d13;
  font-family: var(--sans);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.import-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: none;
}

.import-steps {
  margin: 4px 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
}

.import-steps li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.import-steps li::after {
  content: "";
  height: 1px;
  margin-left: 8px;
  flex: 1;
  background: var(--line);
}

.import-steps li:last-child::after {
  display: none;
}

.import-steps span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
}

.import-steps li.active {
  color: var(--green-750);
  font-weight: 700;
}

.import-steps li.active span {
  border-color: var(--green-650);
  background: var(--green-650);
  color: white;
}

.import-tabs {
  margin-bottom: 18px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-radius: 12px;
  background: #eef2ee;
}

.import-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.import-tabs button.active {
  background: white;
  color: var(--green-750);
  box-shadow: 0 3px 12px rgba(26, 57, 47, 0.08);
  font-weight: 700;
}

.import-source-pane {
  padding: 24px;
  border: 1px dashed #bccac3;
  border-radius: 13px;
  background: #f9fbf9;
}

.import-source-pane label,
#importPreviewStep > label {
  display: grid;
  gap: 8px;
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
}

.parse-summary {
  margin: 16px 0;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  border-radius: 10px;
  background: #eef5f1;
  color: var(--green-750);
  font-size: 11px;
}

.preview-reader {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.preview-reader > div {
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  background: #f2f5f2;
  color: var(--muted);
  font-size: 11px;
}

.preview-reader article {
  max-height: 300px;
  padding: 20px 24px;
  overflow: auto;
  color: #24332d;
  font-size: 13px;
  line-height: 1.8;
}

.preview-reader table,
.reader-content table {
  width: 100%;
  border-collapse: collapse;
}

.preview-reader th,
.preview-reader td,
.reader-content th,
.reader-content td {
  padding: 7px;
  border: 1px solid var(--line);
  text-align: left;
}

.preview-reader img,
.reader-content img {
  max-width: 100%;
  height: auto;
}

.duplicate-warning {
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid #e3a065;
  border-radius: 10px;
  background: #fff5ec;
  color: #7d451a;
  font-size: 12px;
}

.reader-dialog {
  width: min(1240px, calc(100vw - 28px));
  height: min(900px, calc(100vh - 28px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #f7f8f5;
  box-shadow: 0 24px 80px rgba(21, 43, 36, 0.25);
}

.reader-dialog::backdrop {
  background: rgba(14, 29, 24, 0.56);
}

.reader-header {
  min-height: 82px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.reader-header h2,
.reader-header p {
  margin: 0;
}

.reader-header h2 {
  max-width: 760px;
  font-family: var(--serif);
  font-size: 21px;
}

.reader-header > div > p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

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

.reader-layout {
  height: calc(100% - 82px);
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
}

.reader-layout > aside {
  padding: 20px 14px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f1f4f0;
}

.reader-layout > aside > strong {
  padding: 0 8px 10px;
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.reader-layout nav button {
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--green-750);
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}

.reader-layout nav button:hover {
  background: white;
}

.reader-layout > main {
  overflow: auto;
  background: white;
}

.reader-content {
  width: min(820px, calc(100% - 44px));
  margin: 0 auto;
  padding: 48px 0 80px;
  color: #202d28;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 2;
}

.reader-content section,
.reader-content p,
.reader-content h1,
.reader-content h2,
.reader-content h3 {
  scroll-margin-top: 24px;
}

.reader-location {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
}

.pdf-reader {
  width: 100%;
  height: calc(100% - 150px);
  min-height: 620px;
  border: 0;
}

.reader-comments {
  margin: 32px;
  padding: 20px;
  border-top: 1px solid var(--line);
}

.reader-comments p {
  font-size: 12px;
}

@media (max-width: 940px) {
  .primary-nav {
    position: fixed;
    z-index: 55;
    right: 0;
    bottom: 0;
    left: 0;
    height: 58px;
    padding: 0 8px;
    display: flex;
    justify-content: space-around;
    gap: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(30, 53, 45, 0.06);
  }

  .nav-link {
    min-width: 64px;
    font-size: 11px;
  }

  .nav-link.active::after {
    top: 0;
    bottom: auto;
  }

  .collection-view {
    padding-bottom: 90px;
  }

  .learning-view {
    padding-bottom: 90px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

  .compact-search {
    width: 100%;
  }

  .table-row {
    grid-template-columns: minmax(220px, 1fr) 130px 100px auto;
  }

  .table-row .table-cell:nth-of-type(3) {
    display: none;
  }

  .learning-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .research-sources {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  body {
    padding-bottom: 120px;
  }

  .login-screen {
    min-height: 100svh;
    padding: 22px 16px 32px;
    display: block;
  }

  .login-brand {
    margin-bottom: 42px;
  }

  .login-card {
    padding: 26px 20px;
    border-radius: 17px;
  }

  .login-intro h1 {
    font-size: 29px;
  }

  .profile-menu {
    position: fixed;
    top: 58px;
    right: 10px;
  }

  .collection-view {
    padding: 24px 13px 86px;
  }

  .learning-view {
    padding: 24px 13px 86px;
  }

  .page-heading {
    margin-bottom: 20px;
  }

  .page-heading h1 {
    font-size: 25px;
  }

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

  .learning-heading,
  .section-heading,
  .research-console-heading,
  .research-result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .learning-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .learning-filters select {
    width: 100%;
  }

  .learning-stats,
  .learning-list {
    grid-template-columns: 1fr;
  }

  .learning-stats {
    gap: 7px;
  }

  .learning-stats article {
    min-height: 70px;
  }

  .learning-card {
    min-height: 0;
    padding: 18px;
  }

  .learning-card h2 {
    font-size: 17px;
  }

  .research-console {
    padding: 17px 14px;
  }

  .verified-pill {
    align-self: stretch;
    text-align: center;
  }

  .research-controls {
    grid-template-columns: 1fr;
  }

  .research-sources {
    grid-template-columns: 1fr 1fr;
  }

  .backfill-console {
    padding: 17px 14px;
  }

  .backfill-summary {
    grid-template-columns: 1fr 1fr;
  }

  .backfill-source {
    grid-template-columns: 1fr 1fr;
  }

  .backfill-source > strong,
  .backfill-source-error {
    grid-column: 1 / -1;
  }

  .backfill-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .learning-article {
    width: calc(100% - 28px);
    padding: 24px 0 60px;
  }

  .learning-interpretation {
    padding: 19px 16px;
  }

  .learning-interpretation h2,
  .learning-original h2 {
    font-size: 21px;
  }

  .document-table,
  .user-table,
  .candidate-list {
    border-radius: 11px;
  }

  .table-row {
    padding: 14px;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .table-row .table-cell,
  .table-row .table-tags {
    grid-column: 1;
  }

  .row-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    flex-direction: column;
  }

  .scan-status,
  .admin-summary {
    grid-template-columns: 1fr;
  }

  .candidate-card {
    padding: 16px;
    grid-template-columns: 48px 1fr;
    gap: 12px;
  }

  .candidate-score {
    width: 45px;
    height: 45px;
    box-shadow: inset 0 0 0 6px white;
    font-size: 12px;
  }

  .candidate-content h2 {
    font-size: 15px;
  }

  .candidate-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .mobile-evidence-trigger {
    bottom: 68px;
  }

  .toast {
    bottom: 124px;
  }

  .app-dialog > form {
    padding: 18px 15px;
  }

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

  .span-2 {
    grid-column: 1;
  }

  .import-dialog,
  .reader-dialog {
    width: 100vw;
    height: 100svh;
    max-height: none;
    border-radius: 0;
  }

  .import-tabs,
  .import-steps {
    grid-template-columns: 1fr;
  }

  .import-steps li::after {
    display: none;
  }

  .reader-header {
    min-height: 120px;
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-header h2 {
    font-size: 17px;
  }

  .reader-actions {
    width: 100%;
  }

  .reader-layout {
    height: calc(100% - 120px);
    grid-template-columns: 1fr;
  }

  .reader-layout > aside {
    max-height: 110px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader-layout nav {
    display: flex;
    overflow: auto;
  }

  .reader-layout nav button {
    min-width: 120px;
  }

  .reader-content {
    width: calc(100% - 28px);
    padding: 26px 0 60px;
    font-size: 15px;
  }

  .pdf-reader {
    min-height: 560px;
    height: 100%;
  }
}
