:root {
  --ink: #18211d;
  --ink-soft: #34413b;
  --muted: #66736d;
  --faint: #8a958f;
  --line: #dfe5e1;
  --line-strong: #cbd5d0;
  --canvas: #f4f5f3;
  --surface: #ffffff;
  --surface-subtle: #f8f9f7;
  --surface-active: #e9f3ef;
  --accent: #187258;
  --accent-strong: #115c47;
  --amber: #a45c1e;
  --amber-soft: #f7e8d8;
  --topbar: #202b27;
  --topbar-soft: #b9c5bf;
  --shadow-drawer: 0 20px 50px rgba(18, 29, 24, 0.18);
  --topbar-height: 58px;
  --sidebar-width: 252px;
  --detail-width: 388px;
  --radius: 6px;
  --transition: 160ms ease;
  font-family:
    "Microsoft YaHei UI",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
a {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input {
  color: inherit;
}

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

button {
  border: 0;
}

button:not(:disabled),
a[href],
select:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

:focus-visible {
  outline: 3px solid rgba(24, 114, 88, 0.24);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.icon-button.mobile-only,
.icon-button.mobile-nav-toggle,
.icon-button.detail-close {
  display: none;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  min-height: 480px;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--topbar-height);
  padding: 0 14px 0 16px;
  color: #f6faf8;
  background: var(--topbar);
  border-bottom: 1px solid #34413b;
}

.brand {
  display: flex;
  align-items: center;
  width: calc(var(--sidebar-width) - 16px);
  min-width: calc(var(--sidebar-width) - 16px);
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.brand-copy strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-stats {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  margin: 0;
  gap: 0;
}

.top-stats > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  padding: 0 18px;
  gap: 7px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.top-stats dt {
  color: var(--topbar-soft);
  font-size: 11px;
}

.top-stats dd {
  min-width: 18px;
  margin: 0;
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 8px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  gap: 7px;
  color: #dce6e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
}

.connection-dot {
  width: 7px;
  height: 7px;
  background: #a9b5af;
  border-radius: 50%;
}

.connection-state[data-state="ready"] .connection-dot {
  background: #55c99c;
}

.connection-state[data-state="empty"] .connection-dot {
  background: #e2a255;
}

.connection-state[data-state="error"] .connection-dot {
  background: #ef7771;
}

.connection-state[data-state="loading"] .connection-dot {
  animation: soft-pulse 1.25s ease-in-out infinite;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition:
    color var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-active);
  border-color: var(--line);
}

.icon-button-dark {
  color: #dbe5e0;
}

.icon-button-dark:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
}

.icon-button.is-spinning svg,
.search-submit.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(420px, 1fr) var(--detail-width);
  width: 100%;
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
}

.library-sidebar,
.search-workspace,
.detail-pane {
  min-width: 0;
  min-height: 0;
}

.library-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-subtle);
  border-right: 1px solid var(--line);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 14px 11px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title-row h2,
.search-title-row h1,
.detail-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

.context-label {
  max-width: min(58vw, 680px);
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-section {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 0 8px 8px;
}

.document-section {
  flex: 0 0 auto;
  max-height: 42%;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.chapter-section {
  flex: 1 1 auto;
}

.section-label-row {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 7px 7px 5px 8px;
}

.section-label-row h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quiet-count {
  min-width: 22px;
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.document-list,
.chapter-list {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.document-list {
  min-height: 0;
  overflow-y: auto;
}

.chapter-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.document-button,
.chapter-button {
  display: flex;
  width: 100%;
  min-width: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  transition:
    color var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.document-button {
  align-items: flex-start;
  min-height: 54px;
  padding: 9px 8px;
  gap: 9px;
}

.document-button:hover,
.chapter-button:hover {
  color: var(--ink);
  background: #edf2ef;
}

.document-button.is-active,
.chapter-button.is-active {
  color: var(--accent-strong);
  background: var(--surface-active);
  border-color: #c7e0d5;
}

.document-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-top: 1px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 5px;
}

.document-icon svg {
  width: 15px;
  height: 15px;
}

.document-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 3px;
}

.document-title {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta {
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-list {
  padding-bottom: 8px;
}

.chapter-list li + li {
  margin-top: 1px;
}

.chapter-button {
  position: relative;
  align-items: flex-start;
  min-height: 36px;
  padding: 7px 7px 7px calc(8px + (var(--chapter-level, 0) * 12px));
  gap: 7px;
}

.chapter-button svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
  margin-top: 2px;
}

.chapter-button.is-active svg {
  color: var(--accent);
}

.chapter-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

.chapter-title {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chapter-source {
  min-width: 0;
  overflow: hidden;
  color: #52605a;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-page {
  min-width: 24px;
  color: var(--faint);
  margin-top: 1px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sidebar-list-state {
  padding: 3px 8px 8px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-list-state:empty {
  display: none;
}

.sidebar-placeholder {
  display: grid;
  gap: 6px;
}

.sidebar-placeholder span {
  display: block;
  width: 100%;
  height: 30px;
  background: #e9eeeb;
  border-radius: var(--radius);
  animation: shimmer 1.3s ease-in-out infinite alternate;
}

.search-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--canvas);
}

.search-panel {
  position: relative;
  z-index: 2;
  padding: 17px 22px 15px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.search-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.search-title-row h1 {
  margin-top: 2px;
  font-size: 19px;
}

.filter-reset {
  margin-top: 1px;
}

.search-form {
  display: grid;
  gap: 11px;
}

.search-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 42px;
}

.search-input-wrap > svg {
  position: absolute;
  left: 13px;
  z-index: 1;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 40px;
  color: var(--ink);
  background: var(--surface-subtle);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.search-input-wrap input::placeholder,
.page-control input::placeholder {
  color: var(--faint);
}

.search-input-wrap input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 114, 88, 0.12);
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.input-clear {
  position: absolute;
  right: 5px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
}

.input-clear:hover {
  color: var(--ink);
  background: #e8eeea;
}

.input-clear svg {
  width: 15px;
  height: 15px;
}

.primary-button,
.secondary-button,
.state-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 13px;
  gap: 7px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

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

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.search-submit {
  width: 92px;
  height: 42px;
}

.search-submit svg,
.secondary-button svg {
  width: 16px;
  height: 16px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(222px, auto) minmax(132px, 170px) 106px;
  align-items: end;
  justify-content: start;
  gap: 10px;
}

.mode-fieldset,
.field-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-fieldset legend,
.field-control > span:first-child {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  height: 34px;
  padding: 3px;
  background: #edf1ef;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented-control button {
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.segmented-control button:hover {
  color: var(--ink);
}

.segmented-control button.is-active {
  color: var(--accent-strong);
  background: #fff;
  box-shadow: 0 1px 2px rgba(25, 38, 32, 0.09);
  font-weight: 700;
}

.select-wrap,
.number-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 34px;
}

.select-wrap select,
.number-wrap input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  font-size: 12px;
}

.select-wrap select {
  appearance: none;
}

.select-wrap > svg {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.select-wrap select:focus,
.number-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 114, 88, 0.1);
}

.number-wrap input {
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
}

.active-scope {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 31px;
  margin-top: 11px;
  padding: 0 4px 0 9px;
  gap: 7px;
  color: var(--accent-strong);
  background: var(--surface-active);
  border: 1px solid #c8e0d6;
  border-radius: var(--radius);
  font-size: 10px;
}

.active-scope-label {
  color: var(--muted);
}

.scope-value {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-clear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  border-radius: 4px;
}

.scope-clear:hover {
  background: #cfe5dc;
}

.scope-clear svg {
  width: 13px;
  height: 13px;
}

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

.results-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px 22px;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}

.results-heading-row h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.results-heading-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.results-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.result-list {
  min-height: 100%;
  background: var(--surface);
}

.result-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 22px;
  gap: 12px;
  color: var(--muted);
  background: var(--canvas);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.load-more-button {
  min-width: 112px;
}

.load-more-button.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.result-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  padding: 17px 22px;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  outline-offset: -3px;
  transition: background-color var(--transition);
  cursor: pointer;
}

.result-row:hover {
  background: var(--surface-subtle);
}

.result-row.is-active {
  background: #edf5f2;
  box-shadow: inset 3px 0 0 var(--accent);
}

.result-row-main {
  min-width: 0;
}

.result-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: 7px;
  gap: 6px;
}

.content-type-badge,
.page-badge,
.detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.content-type-badge[data-type="image"] {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efd2b3;
}

.content-type-badge[data-type="table"] {
  color: #7b5530;
  background: #f2ede5;
  border-color: #ddd1c1;
}

.page-badge {
  color: #486276;
  background: #eef3f7;
  border-color: #d6e1e9;
}

.result-context {
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-source {
  min-width: 0;
  max-width: 180px;
  flex: 0 1 auto;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-title {
  display: -webkit-box;
  min-width: 0;
  margin: 0 0 7px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-snippet {
  display: -webkit-box;
  max-width: 76ch;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.66;
  overflow-wrap: anywhere;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.result-snippet mark {
  padding: 0 2px;
  color: #6f3e15;
  background: #ffe6ae;
  border-radius: 2px;
}

.result-aside {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.result-thumbnail {
  width: 92px;
  height: 68px;
  object-fit: contain;
  background: #eef1ef;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-loading {
  display: grid;
  min-height: 136px;
  padding: 17px 20px;
  gap: 9px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.skeleton-line {
  height: 12px;
  background: #e8edea;
  border-radius: 4px;
  animation: shimmer 1.3s ease-in-out infinite alternate;
}

.skeleton-line.short {
  width: 22%;
}

.skeleton-line.medium {
  width: 57%;
}

.skeleton-line.long {
  width: 88%;
}

.content-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 300px;
  padding: 36px 24px;
  color: var(--muted);
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: var(--muted);
  background: #edf1ef;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.state-icon svg {
  width: 20px;
  height: 20px;
}

.content-state strong,
.detail-state strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.content-state > span:not(.state-icon),
.detail-state > span:not(.state-icon) {
  max-width: 360px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.state-action {
  height: 32px;
  margin-top: 14px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 11px;
}

.state-action:hover {
  background: var(--surface-active);
  border-color: #b9d8ca;
}

.detail-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 11px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.detail-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100%;
  padding: 30px 22px;
  color: var(--muted);
  text-align: center;
}

.detail-content {
  padding: 20px 20px 26px;
}

.detail-breadcrumb {
  min-width: 0;
  margin-bottom: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-content > h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  margin-top: 9px;
  gap: 5px;
}

.detail-relation {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4f7f5;
}

.detail-relation h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.detail-relation p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.result-stage {
  color: #2f6f57;
  font-weight: 650;
}

.detail-gallery {
  display: grid;
  margin: 19px -20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f0f3f1;
}

.detail-gallery figure {
  display: grid;
  margin: 0;
}

.detail-gallery figure + figure {
  border-top: 1px solid var(--line);
}

.detail-image-link {
  display: block;
  min-width: 0;
  background: #f5f7f6;
  cursor: zoom-in;
}

.detail-gallery img {
  display: block;
  width: 100%;
  max-height: min(46dvh, 460px);
  object-fit: contain;
  background: #f5f7f6;
}

.detail-text-section {
  margin-top: 18px;
}

.detail-text-section h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.detail-text {
  display: grid;
  gap: 11px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.84;
  overflow-wrap: anywhere;
}

.detail-text p,
.detail-list {
  margin: 0;
}

.detail-text p {
  white-space: pre-line;
}

.detail-section-heading {
  margin: 7px 0 0;
  color: var(--ink);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.detail-section-heading:first-child {
  margin-top: 0;
}

.detail-text h5 {
  font-size: 14px;
  line-height: 1.55;
}

.detail-text h6 {
  font-size: 13px;
  line-height: 1.6;
}

.detail-heading-level-1,
.detail-heading-level-2 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.detail-list {
  display: grid;
  padding-left: 19px;
  gap: 5px;
}

.detail-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  overscroll-behavior-inline: contain;
}

.detail-table-wrap:focus-visible {
  outline: 2px solid rgba(27, 127, 96, 0.28);
  outline-offset: 2px;
}

.detail-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.55;
}

.detail-table th,
.detail-table td {
  min-width: 96px;
  max-width: 230px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.detail-table th {
  color: var(--ink);
  background: #edf4f1;
  font-weight: 700;
}

.detail-table tr:last-child > * {
  border-bottom: 0;
}

.detail-table tr > *:last-child {
  border-right: 0;
}

.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 14px 10px 18px;
  gap: 10px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.pdf-page-label {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.secondary-button {
  height: 34px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 12px;
}

.secondary-button:hover {
  background: var(--surface-active);
  border-color: #b8d6c9;
}

.drawer-backdrop {
  position: fixed;
  z-index: 65;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(19, 28, 24, 0.38);
  backdrop-filter: blur(1px);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 9px 12px;
  color: #fff;
  background: #25302b;
  border: 1px solid #3b4842;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(20, 29, 25, 0.18);
  font-size: 11px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes shimmer {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 232px;
    --detail-width: 360px;
  }

  .top-stats > div {
    padding: 0 12px;
  }

  .search-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .results-heading-row,
  .result-row,
  .result-loading {
    padding-right: 16px;
    padding-left: 16px;
  }

  .result-thumbnail {
    width: 72px;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .detail-pane {
    position: fixed;
    z-index: 80;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    width: min(420px, calc(100vw - 36px));
    box-shadow: var(--shadow-drawer);
    transform: translateX(104%);
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 220ms ease,
      visibility 0s linear 220ms;
  }

  body.detail-open .detail-pane {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  body.detail-open .detail-backdrop {
    display: block;
  }

  .icon-button.detail-close {
    display: inline-grid;
  }
}

@media (max-width: 840px) {
  .top-stats > div:nth-child(2),
  .top-stats > div:nth-child(4) {
    display: none;
  }

  .filter-row {
    grid-template-columns: minmax(218px, 1fr) minmax(122px, 150px) 96px;
  }

  .result-thumbnail {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 54px;
  }

  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .icon-button.mobile-nav-toggle {
    display: inline-grid;
    color: #e8efeb;
  }

  .mobile-nav-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .brand {
    width: auto;
    min-width: 0;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .top-stats {
    display: none;
  }

  .connection-state {
    max-width: 98px;
    overflow: hidden;
  }

  .connection-state > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .library-sidebar {
    position: fixed;
    z-index: 80;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: min(320px, calc(100vw - 36px));
    box-shadow: var(--shadow-drawer);
    transform: translateX(-104%);
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 220ms ease,
      visibility 0s linear 220ms;
  }

  body.sidebar-open .library-sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  body.sidebar-open #sidebarBackdrop {
    display: block;
  }

  .icon-button.mobile-only {
    display: inline-grid;
  }

  .document-section {
    max-height: 38%;
  }

  .search-panel {
    padding: 13px 14px 11px;
  }

  .search-title-row {
    margin-bottom: 11px;
  }

  .search-title-row h1 {
    font-size: 17px;
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .mode-fieldset {
    grid-column: 1 / -1;
  }

  .results-heading-row,
  .result-row,
  .result-loading,
  .result-pagination {
    padding-right: 14px;
    padding-left: 14px;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }

}

@media (max-width: 480px) {
  .connection-state {
    display: none;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .search-input-row {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .search-submit {
    width: 42px;
    padding: 0;
  }

  .search-submit .button-label {
    display: none;
  }

  .search-input-wrap input {
    font-size: 12px;
  }

  .result-row {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .result-meta {
    flex-wrap: wrap;
  }

  .result-snippet {
    -webkit-line-clamp: 4;
  }

  .detail-pane {
    width: 100%;
  }

  .detail-content {
    padding: 18px 16px 24px;
  }

  .detail-gallery {
    margin-right: -16px;
    margin-left: -16px;
  }

  .detail-footer {
    padding-left: 12px;
  }

  .secondary-button {
    padding: 0 10px;
  }
}

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