html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  background: #f6f3ee;
  color: #25221d;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  margin-bottom: 60px;
}

/* Phase UI reset: make the site feel like a genealogy workbench first. */
:root {
  --lu-ink: #201b15;
  --lu-paper: #fffdf8;
  --lu-paper-deep: #f2eadc;
  --lu-border: #cfc0ac;
  --lu-red: #c01818;
  --lu-green: #214f45;
  /* 印泥朱（题眼/印信，较 --lu-red 更深雅，与卷首一致） */
  --lu-zhu: #993C1D;
  /* CJK 衬线字体栈：优先机器已装的思源宋体/Source Han，退到系统宋体；零外链、离线/墙内不挂 */
  --lu-serif: "Source Han Serif SC", "Source Han Serif CN", "Noto Serif SC", "Songti SC", "STSong", "SimSun", "宋体", serif;
}

/* —— 雅致皮·字体统一：CJK 衬线覆盖 谱牒/编修(wbk)·付印·寻亲，与「卷首」一致（朱色accent因层叠须各页内联末尾覆盖，不在此处） —— */
.wbk, body.body-workbench, body.body-publish, .search-page, .highlights-page { font-family: var(--lu-serif); }

body {
  background:
    linear-gradient(90deg, rgba(32, 27, 21, 0.04) 0, transparent 22%, transparent 78%, rgba(32, 27, 21, 0.04) 100%),
    #f3eee5;
}

body > header {
  background: rgba(255, 253, 248, 0.96);
  border-bottom: 1px solid var(--lu-border);
  box-shadow: 0 6px 20px rgba(37, 31, 24, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.navbar {
  margin-bottom: 0 !important;
  min-height: 54px;
  padding: 0;
}

.navbar .container-fluid {
  gap: 18px;
  max-width: 1720px;
}

.navbar-brand {
  color: var(--lu-red) !important;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.25rem;
  letter-spacing: 0;
  min-width: max-content;
}

.navbar-brand::before {
  content: "水源山";
  border: 1px solid var(--lu-red);
  color: var(--lu-red);
  display: inline-block;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  margin-right: 8px;
  padding: 3px 4px;
  vertical-align: 2px;
}

.navbar-collapse {
  min-width: 0;
}

.navbar-nav {
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.navbar-nav .nav-link {
  border: 1px solid transparent;
  border-radius: 2px;
  color: #3a332b !important;
  font-size: 0.94rem;
  font-weight: 680;
  line-height: 1;
  min-height: 34px;
  padding: 9px 10px;
  white-space: nowrap;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.is-active {
  background: #f4eadb;
  border-color: #d9c8b0;
  color: var(--lu-green) !important;
}

.layout-logout-form {
  margin: 0;
}

.layout-logout-form button {
  background: transparent;
  cursor: pointer;
}

.auth-nav {
  border-left: 1px solid #e1d4c1;
  flex: 0 0 auto;
  padding-left: 8px;
}

.page-container {
  max-width: 1720px;
  padding: 0 16px;
}

main.pb-3 {
  padding-bottom: 18px !important;
}

.detail-header,
.result-band,
.detail-section,
.query-panel,
.cover-figure,
.person-card,
.search-result-row,
.export-proof-panel,
.archive-save-result,
.archive-error-panel {
  border-radius: 2px;
}

.detail-header {
  background: var(--lu-paper);
  border: 1px solid var(--lu-border);
  box-shadow: 0 1px 0 rgba(32, 27, 21, 0.04);
}

.detail-header h1 {
  color: var(--lu-ink);
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  letter-spacing: 0;
}

.eyebrow {
  color: #8a3d16;
}

.lead-text {
  max-width: none;
}

.search-page,
.relationship-page {
  display: grid;
  gap: 12px;
  margin: 16px calc(50% - 50vw + 24px);
  padding: 0 24px;
}

.search-page .detail-header,
.relationship-page > .detail-header {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, auto);
  padding: 14px 18px;
}

.search-page-form,
.relation-page-form {
  background: #f8f1e6;
  border: 1px solid #d9c8b0;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.search-page-form {
  align-items: end;
  grid-template-columns: minmax(220px, 1fr) 110px;
  margin: 0;
}

.relation-page-form {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 140px;
}

.relation-page-form .detail-link {
  grid-column: 1 / -1;
}

.search-results-band,
.relationship-result,
.path-to-common,
.display-chain-panel {
  margin: 0;
}

.search-result-list {
  display: grid;
  gap: 0;
}

.search-result-row {
  background: #fff;
  border: 1px solid #d7c9b7;
  display: grid;
  gap: 10px 14px;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
  margin-top: -1px;
  padding: 12px 14px 12px 28px;
  position: relative;
}

.search-result-row::before {
  background: #b9aa91;
  bottom: 0;
  content: "";
  left: 12px;
  position: absolute;
  top: 0;
  width: 1px;
}

.search-result-row::after {
  background: #b9aa91;
  content: "";
  height: 1px;
  left: 12px;
  position: absolute;
  top: 32px;
  width: 14px;
}

.search-person-main h2 {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.28rem;
  margin-bottom: 4px;
}

.search-facts,
.record-facts,
.distance-grid {
  gap: 8px;
}

.result-actions,
.relation-output-actions,
.detail-actions {
  gap: 8px;
}

.detail-link,
.secondary-link,
.generation-page-nav a,
.generation-page-nav button,
.print-preview-toolbar a,
.print-preview-toolbar button {
  border-radius: 2px !important;
}

.pedigree-page {
  gap: 10px;
  margin: 12px calc(50% - 50vw + 16px);
  padding: 0 16px;
}

.pedigree-header {
  align-items: end;
  grid-template-columns: minmax(360px, 1fr) minmax(520px, auto);
  padding: 10px 14px;
}

.pedigree-header h1 {
  font-size: 1.35rem;
}

.pedigree-header .lead-text {
  margin-top: 4px;
}

.pedigree-workbench {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: 420px minmax(0, 1fr);
  height: calc(100vh - 142px);
  min-height: 680px;
}

.pedigree-tree-panel {
  max-height: none;
  overflow: auto;
  position: static;
}

.pedigree-main-panel {
  gap: 10px;
  max-height: 100%;
  overflow: auto;
  padding-right: 2px;
}

.pedigree-selected-card {
  grid-template-columns: minmax(210px, 0.62fr) minmax(380px, 1.38fr);
  padding: 10px 12px;
}

.pedigree-chart-scroll {
  height: min(58vh, 680px);
  margin-top: 8px;
  overflow: auto;
  padding: 12px;
}

.pedigree-print-sheet {
  min-height: 620px;
}

.pedigree-table-section {
  padding: 10px;
}

.generation-page:not(.print-preview-mode) {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(980px, 1fr) 340px;
  margin: 12px calc(50% - 50vw + 16px);
  padding: 0 16px;
}

.generation-page:not(.print-preview-mode) .generation-header,
.generation-page:not(.print-preview-mode) .compact-generation-summary,
.generation-page:not(.print-preview-mode) .export-proof-panel,
.generation-page:not(.print-preview-mode) .archive-save-result,
.generation-page:not(.print-preview-mode) .archive-error-panel,
.generation-page:not(.print-preview-mode) .copy-panel {
  grid-column: 2;
  margin: 0;
}

.generation-page:not(.print-preview-mode) .generation-header {
  display: block;
  padding: 12px;
  position: sticky;
  top: 66px;
  z-index: 4;
}

.generation-page:not(.print-preview-mode) .generation-header h1 {
  font-size: 1.25rem;
}

.generation-page:not(.print-preview-mode) .generation-header .lead-text {
  font-size: 0.88rem;
  line-height: 1.55;
}

.generation-page:not(.print-preview-mode) .generation-form {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.generation-page:not(.print-preview-mode) .generation-form label:first-child,
.generation-page:not(.print-preview-mode) .generation-form button {
  grid-column: 1 / -1;
}

.generation-page:not(.print-preview-mode) .compact-generation-summary {
  padding: 12px;
}

.generation-page:not(.print-preview-mode) .compact-generation-summary .result-heading {
  align-items: stretch;
  display: grid;
  gap: 10px;
}

.generation-page:not(.print-preview-mode) .compact-generation-summary .generation-counts {
  grid-template-columns: 1fr 1fr;
}

.generation-page:not(.print-preview-mode) .generation-page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.generation-page:not(.print-preview-mode) .generation-page-nav span {
  grid-column: 1 / -1;
  order: -1;
}

.generation-page:not(.print-preview-mode) .continuous-preview-stack {
  grid-column: 1;
  grid-row: 1 / span 8;
}

.generation-page:not(.print-preview-mode) .genealogy-output-sheet.generation-record-list {
  margin-top: 0;
  min-width: 0;
  width: 100%;
}

.generation-page:not(.print-preview-mode) .generation-record-list .genealogy-output-table {
  min-width: 0;
}

.generation-page:not(.print-preview-mode) .export-proof-panel {
  padding: 12px;
}

.generation-page:not(.print-preview-mode) .export-proof-grid {
  grid-template-columns: 1fr;
}

.generation-page:not(.print-preview-mode) .export-proof-item {
  padding: 8px;
}

.draft-workbench-page {
  margin: 12px calc(50% - 50vw + 16px);
  padding: 0 16px;
}

.draft-workbench-page > .detail-header,
.draft-header {
  border-radius: 2px;
}

@media (max-width: 1180px) {
  .navbar-nav {
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .search-page .detail-header,
  .relationship-page > .detail-header,
  .pedigree-header,
  .generation-page:not(.print-preview-mode),
  .pedigree-workbench,
  .search-result-row {
    grid-template-columns: 1fr;
  }

  .generation-page:not(.print-preview-mode) .generation-header,
  .generation-page:not(.print-preview-mode) .compact-generation-summary,
  .generation-page:not(.print-preview-mode) .export-proof-panel,
  .generation-page:not(.print-preview-mode) .archive-save-result,
  .generation-page:not(.print-preview-mode) .archive-error-panel,
  .generation-page:not(.print-preview-mode) .copy-panel,
  .generation-page:not(.print-preview-mode) .continuous-preview-stack {
    grid-column: 1;
    grid-row: auto;
  }

  .pedigree-workbench {
    height: auto;
  }

  .pedigree-chart-scroll {
    height: 68vh;
  }
}

@media (max-width: 720px) {
  .page-container {
    padding: 0 10px;
  }

  .search-page,
  .relationship-page,
  .pedigree-page,
  .generation-page:not(.print-preview-mode),
  .draft-workbench-page {
    margin-left: calc(50% - 50vw + 10px);
    margin-right: calc(50% - 50vw + 10px);
    padding: 0 10px;
  }

  .relation-page-form,
  .search-page-form,
  .generation-page:not(.print-preview-mode) .generation-form,
  .generation-page:not(.print-preview-mode) .generation-page-nav,
  .generation-page:not(.print-preview-mode) .compact-generation-summary .generation-counts {
    grid-template-columns: 1fr;
  }

  .pedigree-selected-card {
    grid-template-columns: 1fr;
  }
}

.navbar-brand {
  font-weight: 700;
}

.auth-nav {
  align-items: center;
}

.auth-name {
  font-weight: 700;
}

.auth-logout-form {
  margin: 0;
}

.auth-link-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
}

.page-container {
  margin: 0 auto;
  max-width: 1440px;
  padding: 0 24px;
}

.home-shell {
  align-items: stretch;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 320px;
  margin: 24px 0;
}

.query-panel {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 420px);
  padding: 28px;
}

.eyebrow {
  color: #7a4e2b;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
}

.query-copy h1,
.result-heading h2 {
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.query-copy h1 {
  font-size: 2.4rem;
}

.lead-text {
  color: #5f5a52;
  font-size: 1.05rem;
  line-height: 1.75;
  margin: 16px 0 0;
  max-width: 680px;
}

.relationship-form,
.person-search-form {
  align-content: start;
  display: grid;
  gap: 14px;
}

.relationship-form label,
.person-search-form label {
  display: grid;
  gap: 6px;
}

.relationship-form span,
.person-search-form span {
  color: #4b463f;
  font-weight: 650;
}

.relationship-form input,
.person-search-form input {
  border: 1px solid #c9bba7;
  border-radius: 6px;
  font-size: 1rem;
  min-height: 44px;
  padding: 8px 12px;
}

.relationship-form button,
.person-search-form button {
  background: #2d5b53;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 14px;
}

.person-search-form {
  grid-template-columns: minmax(220px, 1fr) 120px;
  margin-top: 22px;
}

.person-search-form button {
  align-self: end;
}

.cover-figure {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  margin: 0;
  overflow: hidden;
}

.cover-figure img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.result-band {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  margin: 24px 0;
  padding: 28px;
}

.result-band.warning {
  border-color: #c07c59;
}

.result-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.ancestor-badge {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  border-radius: 8px;
  min-width: 180px;
  padding: 10px 14px;
}

.ancestor-badge span {
  color: #4f655f;
  display: block;
  font-size: 0.82rem;
}

.ancestor-badge strong {
  color: #1f4f47;
  display: block;
  font-size: 1.05rem;
}

.summary-text {
  border-left: 4px solid #b9874c;
  font-size: 1.08rem;
  line-height: 1.8;
  margin: 22px 0;
  padding-left: 14px;
}

.relation-page-form {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 16px;
}

.distance-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.distance-grid div {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  border-radius: 8px;
  padding: 12px 14px;
}

.distance-grid span {
  color: #4f655f;
  display: block;
  font-size: 0.92rem;
}

.distance-grid strong {
  color: #1f4f47;
  display: block;
  font-size: 1.18rem;
  margin-top: 4px;
}

.chain-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chain-grid section {
  border-top: 1px solid #e6ded1;
  padding-top: 14px;
}

.chain-grid h3 {
  font-size: 1rem;
  font-weight: 750;
  margin: 0 0 10px;
}

.chain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chain-list li {
  background: #f3eadb;
  border: 1px solid #d6c3a6;
  border-radius: 6px;
  padding: 6px 10px;
}

.chain-list a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.chain-list a:hover {
  text-decoration: underline;
}

.chain-list.display-chain li {
  background: #eef0ea;
  border-color: #cbd1c2;
}

.people-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.person-card {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 16px;
}

.person-card h3 {
  font-size: 1.12rem;
  font-weight: 760;
  margin: 0;
}

.compact-person-card {
  margin-top: 10px;
}

.compact-person-card h4 {
  font-size: 1rem;
  font-weight: 760;
  margin: 0;
}

.person-title {
  color: #7a4e2b;
  font-weight: 700;
  margin: 4px 0 0;
}

.person-card p {
  color: #4f4a42;
  line-height: 1.7;
  margin: 12px 0;
}

.person-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.person-card dl div {
  display: grid;
  gap: 4px;
  grid-template-columns: 72px minmax(0, 1fr);
}

.person-card dt {
  color: #716b60;
  font-weight: 700;
}

.person-card dd {
  margin: 0;
}

.detail-link {
  color: #1f4f47;
  display: inline-block;
  font-weight: 750;
  margin-top: 14px;
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

.secondary-link {
  color: #6a4b2b;
  margin-left: 12px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.home-entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.search-page {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.search-header {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
}

.search-page-form {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  grid-template-columns: minmax(220px, 1fr) 120px;
  margin-top: 0;
  padding: 16px;
}

.search-results-band {
  margin-top: 0;
}

.search-result-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.search-result-row {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.35fr);
  padding: 16px;
}

.search-person-main h2 {
  font-size: 1.16rem;
  font-weight: 760;
  margin: 0;
}

.search-person-main h2 a {
  color: #1f4f47;
  text-decoration: none;
}

.search-person-main h2 a:hover {
  text-decoration: underline;
}

.search-person-main p {
  color: #4f4a42;
  line-height: 1.7;
  margin: 10px 0 0;
}

.search-facts {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.search-facts div {
  background: #fffdf8;
  border: 1px solid #e6ded1;
  border-radius: 6px;
  padding: 8px 10px;
}

.search-facts dt {
  color: #716b60;
  font-size: 0.86rem;
  font-weight: 700;
}

.search-facts dd {
  margin: 2px 0 0;
}

.matched-name-strip,
.result-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  grid-column: 1 / -1;
}

.matched-name-strip {
  border-top: 1px solid #e8ddcf;
  padding-top: 12px;
}

.matched-name-strip strong {
  color: #7a4e2b;
}

.matched-name-strip span {
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  border-radius: 6px;
  padding: 4px 8px;
}

.result-actions {
  border-top: 1px solid #e8ddcf;
  padding-top: 12px;
}

.detail-shell {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.detail-header,
.detail-section {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  padding: 28px;
}

.detail-header {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.detail-header h1 {
  font-size: 2.2rem;
  font-weight: 760;
  letter-spacing: 0;
  margin: 0;
}

.detail-title {
  color: #7a4e2b;
  font-size: 1.08rem;
  font-weight: 700;
  margin: 8px 0 0;
}

.detail-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-facts div {
  border-bottom: 1px solid #e8ddcf;
  display: grid;
  gap: 8px;
  grid-template-columns: 76px minmax(0, 1fr);
  padding-bottom: 10px;
}

.detail-facts dt {
  color: #716b60;
  font-weight: 700;
}

.detail-facts dd {
  margin: 0;
}

.detail-section h2 {
  font-size: 1.22rem;
  font-weight: 760;
  margin: 0 0 16px;
}

.relation-list,
.event-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.relation-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.relation-list article,
.event-list article {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 14px;
}

.relation-list strong,
.event-list strong {
  color: #1f4f47;
  display: inline-block;
  font-weight: 760;
  margin-right: 8px;
}

.relation-list span,
.event-list span {
  color: #716b60;
  font-size: 0.92rem;
}

.relation-list p,
.event-list p {
  line-height: 1.75;
  margin: 8px 0 0;
}

.relation-list small {
  color: #716b60;
  display: block;
  line-height: 1.6;
  margin-top: 6px;
}

.classic-text p {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.06rem;
}

.empty-note {
  background: #f7f1e7;
  border: 1px dashed #cdbb9e;
  border-radius: 8px;
  color: #5f5a52;
  line-height: 1.8;
  margin: 0;
  padding: 14px;
}

.section-note {
  color: #5f5a52;
  line-height: 1.75;
  margin: 0 0 14px;
}

.descendant-list {
  display: grid;
  gap: 10px;
}

.descendant-item {
  align-items: center;
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 72px minmax(160px, 1fr) minmax(180px, 1.2fr);
  padding: 12px 14px;
}

.descendant-item strong {
  color: #7a4e2b;
}

.descendant-item a {
  color: #1f4f47;
  font-weight: 760;
  text-decoration: none;
}

.descendant-item a:hover {
  text-decoration: underline;
}

.descendant-item span {
  color: #5f5a52;
}

.descendant-item.depth-2 {
  margin-left: 18px;
}

.descendant-item.depth-3 {
  margin-left: 36px;
}

.generation-page {
  margin: 24px calc(50% - 50vw + 24px);
  padding: 0 24px;
}

.generation-header {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.generation-form {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 16px;
}

.generation-counts {
  min-width: 320px;
}

.generation-record-list {
  display: grid;
  gap: 12px;
}

.generation-record {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-left: 6px solid #b9874c;
  border-radius: 8px;
  margin-left: calc(var(--depth) * 22px);
  padding: 18px;
}

.generation-record-head {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 520px);
}

.record-generation {
  color: #7a4e2b;
  display: block;
  font-size: 0.88rem;
  font-weight: 760;
  margin-bottom: 4px;
}

.generation-record h2 {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.45rem;
  font-weight: 760;
  margin: 0;
}

.generation-record h2 a,
.spouse-strip a {
  color: #1f4f47;
  text-decoration: none;
}

.generation-record h2 a:hover,
.spouse-strip a:hover {
  text-decoration: underline;
}

.generation-record h2 small {
  color: #716b60;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  margin-left: 8px;
}

.record-facts {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.record-facts div {
  background: #f7f1e7;
  border: 1px solid #e3d4bf;
  border-radius: 6px;
  padding: 8px 10px;
}

.record-facts dt {
  color: #716b60;
  font-size: 0.86rem;
  font-weight: 700;
}

.record-facts dd {
  margin: 2px 0 0;
}

.spouse-strip {
  align-items: start;
  border-top: 1px solid #e8ddcf;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.spouse-strip > strong {
  color: #7a4e2b;
  margin-top: 3px;
}

.spouse-strip span {
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  border-radius: 6px;
  line-height: 1.7;
  padding: 6px 10px;
}

.spouse-strip em {
  color: #6a4b2b;
  font-style: normal;
  font-weight: 700;
  margin-left: 6px;
}

.spouse-strip b {
  background: #f3eadb;
  border-radius: 4px;
  color: #7a4e2b;
  font-size: 0.82rem;
  margin-left: 6px;
  padding: 2px 6px;
}

.spouse-strip small {
  color: #716b60;
  display: block;
}

.generation-classic-text {
  border-top: 1px solid #e8ddcf;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.08rem;
  line-height: 1.9;
  margin-top: 14px;
  padding-top: 12px;
}

.generation-classic-text p {
  margin: 0;
}

.generation-classic-text p + p {
  margin-top: 8px;
}

.generation-classic-text strong {
  color: #7a4e2b;
  margin-right: 8px;
}

.generation-classic-text span {
  color: #716b60;
  margin-right: 8px;
}

.compact-empty-note {
  margin-top: 14px;
  padding: 10px 12px;
}

.modern-profile-strip {
  border-top: 1px solid #e8ddcf;
  color: #4f4a42;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
}

.modern-profile-strip span {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  border-radius: 6px;
  padding: 6px 10px;
}

.copy-panel {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  margin-top: 16px;
  padding: 14px 18px;
}

.copy-panel summary {
  color: #1f4f47;
  cursor: pointer;
  font-weight: 760;
}

.copy-panel pre {
  background: #f7f1e7;
  border-radius: 6px;
  color: #25221d;
  margin: 14px 0 0;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.archive-page {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.archive-header {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.archive-summary {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
}

.archive-summary div {
  border-bottom: 1px solid #e8ddcf;
  display: grid;
  gap: 6px;
  grid-template-columns: 92px minmax(0, 1fr);
  padding-bottom: 10px;
}

.archive-summary div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.archive-summary dt {
  color: #716b60;
  font-weight: 700;
}

.archive-summary dd {
  margin: 0;
}

.archive-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-tabs a {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 6px;
  color: #4f4a42;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
}

.archive-tabs a.active {
  background: #2d5b53;
  border-color: #2d5b53;
  color: #fff;
}

.archive-tabs span {
  color: inherit;
  font-weight: 700;
  margin-left: 4px;
}

.archive-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.archive-card {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  display: grid;
  grid-template-rows: minmax(220px, auto) 1fr;
  overflow: hidden;
}

.archive-preview {
  background: #f3eadb;
  border-bottom: 1px solid #ded6c8;
  min-height: 220px;
}

.archive-preview img,
.archive-preview video,
.archive-preview iframe {
  border: 0;
  display: block;
  height: 260px;
  object-fit: contain;
  width: 100%;
}

.archive-preview iframe {
  background: #fff;
}

.archive-preview-placeholder {
  align-items: center;
  color: #6a4b2b;
  display: grid;
  gap: 8px;
  min-height: 220px;
  place-content: center;
  text-align: center;
}

.archive-preview-placeholder strong {
  color: #7a4e2b;
  font-size: 1.4rem;
}

.archive-card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.archive-card h2 {
  font-size: 1.18rem;
  font-weight: 760;
  margin: 0;
}

.archive-note {
  color: #4f4a42;
  line-height: 1.7;
  margin: 0;
}

.archive-facts {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.archive-facts div {
  background: #fbf6ec;
  border: 1px solid #e6ded1;
  border-radius: 6px;
  padding: 8px 10px;
}

.archive-facts dt {
  color: #716b60;
  font-size: 0.86rem;
  font-weight: 700;
}

.archive-facts dd {
  margin: 2px 0 0;
}

.archive-facts a {
  color: #1f4f47;
  font-weight: 700;
  text-decoration: none;
}

.archive-facts a:hover {
  text-decoration: underline;
}

.missing-file-note,
.large-file-note {
  border-radius: 6px;
  line-height: 1.7;
  margin: 0;
  padding: 10px 12px;
}

.missing-file-note {
  background: #fff2e8;
  border: 1px solid #d8a77c;
  color: #6f3e19;
}

.large-file-note {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  color: #1f4f47;
}

.archive-actions {
  align-items: center;
  border-top: 1px solid #e8ddcf;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 12px;
}

.download-disabled {
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  border-radius: 6px;
  color: #4f4a42;
  font-weight: 700;
  padding: 6px 10px;
}

.branch-map-page {
  display: grid;
  gap: 18px;
  margin: 24px calc(50% - 50vw + 24px);
  padding: 0 24px;
}

.branch-map-header {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.branch-map-shell {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  overflow: hidden;
}

.branch-map-toolbar {
  align-items: center;
  background: #fbf6ec;
  border-bottom: 1px solid #ded6c8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
}

.branch-map-toolbar button {
  background: #2d5b53;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  height: 38px;
  line-height: 1;
  min-width: 38px;
}

.branch-map-toolbar button:hover {
  background: #214a43;
}

.branch-map-scale {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 6px;
  color: #8d2b25;
  display: inline-flex;
  font-size: .92rem;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  min-width: 64px;
  padding: 0 10px;
}

.branch-map-stage {
  background: #efe8dc;
  cursor: grab;
  display: block;
  height: min(78vh, 900px);
  min-height: 420px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.branch-map-stage.dragging {
  cursor: grabbing;
}

.branch-map-stage img {
  display: block;
  left: 0;
  max-height: none;
  max-width: none;
  object-fit: initial;
  position: absolute;
  top: 0;
  transform-origin: 0 0;
  transition: transform 120ms ease-out;
  will-change: transform;
}

.branch-map-stage.dragging img {
  transition: none;
}

.highlights-page {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.highlights-header {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.highlight-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.highlight-topics a {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 6px;
  color: #4f4a42;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
}

.highlight-topics a.active {
  background: #2d5b53;
  border-color: #2d5b53;
  color: #fff;
}

.highlight-topics span {
  margin-left: 4px;
}

.highlight-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.highlight-card {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  display: grid;
  grid-template-rows: minmax(220px, auto) 1fr;
  overflow: hidden;
}

.highlight-media {
  background: #f3eadb;
  border-bottom: 1px solid #ded6c8;
  min-height: 220px;
}

.highlight-media img,
.highlight-media video {
  display: block;
  height: 240px;
  object-fit: cover;
  width: 100%;
}

.highlight-media video {
  background: #25221d;
  object-fit: contain;
}

.highlight-placeholder {
  align-items: center;
  color: #6a4b2b;
  display: grid;
  gap: 8px;
  min-height: 220px;
  place-content: center;
  text-align: center;
}

.highlight-placeholder strong {
  color: #7a4e2b;
  font-size: 1.4rem;
}

.highlight-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.highlight-body h2 {
  font-size: 1.12rem;
  font-weight: 760;
  margin: 0;
}

.admin-page {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.admin-header {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
}

.admin-readonly-note {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  border-radius: 8px;
  color: #1f4f47;
  margin: 0;
  padding: 16px;
}

.admin-readonly-note strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.admin-readonly-note p {
  line-height: 1.75;
  margin: 0;
}

.admin-kpi-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-kpi-grid article {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  padding: 16px;
}

.admin-kpi-grid span {
  color: #716b60;
  display: block;
  font-weight: 700;
}

.admin-kpi-grid strong {
  color: #1f4f47;
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  margin-top: 8px;
}

.admin-filter-panel,
.admin-table-section {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  padding: 22px;
}

.admin-filter-panel {
  display: grid;
  gap: 18px;
}

.admin-filter-panel h2 {
  font-size: 1.05rem;
  font-weight: 760;
  margin: 0 0 10px;
}

.admin-tabs {
  margin: 0;
}

.admin-table-section {
  display: grid;
  gap: 16px;
}

.admin-table-scroll {
  overflow-x: auto;
}

.admin-media-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1180px;
  width: 100%;
}

.admin-media-table th,
.admin-media-table td {
  border-bottom: 1px solid #e6ded1;
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.admin-media-table th {
  background: #f3eadb;
  color: #4f4a42;
  font-size: 0.9rem;
  font-weight: 760;
  position: sticky;
  top: 0;
}

.admin-media-table td {
  background: #fffdf8;
}

.admin-media-table td:first-child {
  min-width: 280px;
}

.admin-media-table td:nth-child(5) {
  min-width: 280px;
}

.admin-media-table strong,
.admin-media-table small,
.admin-media-table span {
  display: block;
}

.admin-media-table small {
  color: #716b60;
  line-height: 1.6;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.admin-media-table td > span {
  color: #4f4a42;
  line-height: 1.65;
  margin-top: 6px;
}

.admin-status,
.admin-state {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.86rem;
  font-weight: 760;
  padding: 4px 9px;
  width: fit-content;
}

.admin-status.is-published,
.admin-state.ok {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  color: #1f4f47;
}

.admin-status.needs-metadata,
.admin-status.needs-preview,
.admin-state.warning {
  background: #fff2e8;
  border: 1px solid #d8a77c;
  color: #6f3e19;
}

.admin-status.is-draft,
.admin-status.is-private,
.admin-status.is-archived,
.admin-status.is-other {
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  color: #4f4a42;
}

.admin-users-table {
  min-width: 1280px;
}

.admin-users-table td:first-child {
  min-width: 220px;
}

.admin-users-table td:nth-child(2) {
  min-width: 260px;
}

.admin-users-table td:nth-child(4) {
  min-width: 310px;
}

.admin-status.user-status-active {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  color: #1f4f47;
}

.admin-status.user-status-pending {
  background: #fff7e6;
  border: 1px solid #dfc68f;
  color: #8a4a11;
}

.admin-status.user-status-disabled {
  background: #f2eeee;
  border: 1px solid #d9c4c4;
  color: #8f2f24;
}

.user-admin-form {
  display: grid;
  gap: 10px;
}

.user-admin-form label {
  display: grid;
  gap: 4px;
}

.user-admin-form label > span,
.user-admin-form legend {
  color: #4b463f;
  font-size: 0.9rem;
  font-weight: 720;
}

.user-admin-form select,
.user-admin-form input[type="password"] {
  border: 1px solid #c9bba7;
  border-radius: 4px;
  min-height: 36px;
  padding: 6px 8px;
}

.user-admin-form fieldset {
  border: 1px solid #e5d8c5;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 10px;
}

.user-admin-form .role-check {
  justify-content: flex-start;
}

.user-admin-form button {
  background: #2d5b53;
  border: 0;
  border-radius: 4px;
  color: #fff;
  font-weight: 760;
  min-height: 36px;
  padding: 7px 12px;
}

.user-reset-form button {
  background: #7f2d22;
}

.password-reset-table {
  min-width: 1040px;
}

.password-reset-table td:first-child {
  min-width: 220px;
}

.password-reset-table td:nth-child(3) {
  min-width: 280px;
}

.dismiss-reset-form {
  margin-top: 10px;
}

.dismiss-reset-form button {
  background: #6f6254;
}

.output-settings-page {
  gap: 14px;
}

.output-settings-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.output-settings-kpis article strong {
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.output-word-section {
  gap: 12px;
}

.output-word-strip {
  border: 1px solid #25221d;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px, 1fr);
  max-width: 980px;
}

.output-word-strip span {
  align-items: center;
  border-right: 1px solid #25221d;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1rem;
  justify-content: center;
  min-height: 30px;
}

.output-word-strip span:last-child {
  border-right: 0;
}

.output-profile-table {
  min-width: 1040px;
}

.output-profile-row td:last-child {
  min-width: 150px;
}

.generation-word-table {
  min-width: 860px;
}

.generation-word-table td:first-child {
  min-width: 150px;
}

.generation-word-table td:nth-child(4) {
  min-width: 280px;
}

.generation-word-form input[name$=".Word"] {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.15rem;
  font-weight: 760;
}

.output-profile-edit-section {
  gap: 14px;
}

.output-profile-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.output-profile-form label {
  display: grid;
  gap: 6px;
}

.output-profile-form label > span:first-child {
  color: #4f4a42;
  font-weight: 760;
}

.output-profile-form input,
.output-profile-form select,
.output-profile-form textarea {
  background: #fff;
  border: 1px solid #cdbb9f;
  border-radius: 2px;
  color: #1d1b17;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
}

.output-profile-form select {
  cursor: pointer;
}

.output-profile-form textarea {
  line-height: 1.6;
  resize: vertical;
}

.output-profile-form .wide-field,
.output-profile-form .form-actions,
.output-profile-form .field-validation {
  grid-column: 1 / -1;
}

.output-profile-form .form-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.output-profile-form button {
  background: #1f4f47;
  border: 1px solid #1f4f47;
  border-radius: 2px;
  color: #fff;
  cursor: pointer;
  font-weight: 760;
  min-height: 38px;
  padding: 8px 14px;
}

.admin-login-required {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 2px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.admin-login-required p {
  margin: 0;
}

.admin-asset-file-grid {
  border: 1px solid #dfd2bd;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.admin-asset-file-grid div {
  border-bottom: 1px solid #dfd2bd;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.admin-asset-file-grid div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.admin-asset-file-grid dt {
  color: #716b60;
  font-size: 0.8rem;
  font-weight: 760;
}

.admin-asset-file-grid dd {
  color: #25221d;
  margin: 0;
  overflow-wrap: anywhere;
}

.metadata-note,
.preview-note {
  border-radius: 6px;
  line-height: 1.7;
  margin: 0 0 8px;
  padding: 10px 12px;
}

.metadata-note {
  background: #fff2e8;
  border: 1px solid #d8a77c;
  color: #6f3e19;
}

.preview-note {
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  color: #4f4a42;
}

.publication-table {
  min-width: 940px;
}

.publication-candidate-list {
  border: 1px solid #dfd2bd;
  display: grid;
  gap: 0;
}

.publication-candidate {
  align-items: start;
  border-bottom: 1px solid #dfd2bd;
  display: grid !important;
  gap: 10px !important;
  grid-template-columns: 22px minmax(0, 1fr);
  padding: 12px;
}

.publication-candidate:last-child {
  border-bottom: 0;
}

.publication-candidate input {
  margin-top: 4px;
  min-height: 0;
}

.publication-candidate strong,
.publication-candidate small {
  display: block;
}

.publication-candidate small {
  color: #716b60;
  line-height: 1.55;
  margin-top: 4px;
}

.publication-review-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.publication-review-list li {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 2px;
  padding: 12px 14px;
}

.publication-review-list strong,
.publication-review-list span {
  display: block;
}

.publication-review-list span {
  color: #716b60;
  margin-top: 3px;
}

.publication-review-list p {
  line-height: 1.7;
  margin: 8px 0 0;
}

.publication-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.publication-card {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.publication-card h2 {
  font-size: 1.16rem;
  font-weight: 760;
  margin: 0;
}

.publication-card p {
  color: #4f4a42;
  line-height: 1.7;
  margin: 0;
}

.account-page,
.draft-page {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.account-header,
.draft-header {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
}

.account-form {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  display: grid;
  gap: 22px;
  padding: 24px;
}

.account-form-narrow {
  max-width: 720px;
}

.account-form h2 {
  font-size: 1.08rem;
  font-weight: 760;
  margin: 0 0 14px;
}

.account-fields {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-fields.single-column {
  grid-template-columns: 1fr;
}

.account-fields label {
  display: grid;
  gap: 6px;
}

.account-fields span {
  color: #4b463f;
  font-weight: 650;
}

.account-fields input,
.account-fields select,
.account-fields textarea {
  border: 1px solid #c9bba7;
  border-radius: 6px;
  font: inherit;
  min-height: 44px;
  padding: 8px 12px;
}

.account-fields textarea {
  min-height: 110px;
  resize: vertical;
}

.account-fields small {
  color: #716b60;
  line-height: 1.5;
}

.wide-field {
  grid-column: 1 / -1;
}

.check-row {
  align-items: center;
  display: flex !important;
  gap: 8px;
}

.check-row input {
  min-height: 0;
  width: auto;
}

.account-actions {
  align-items: center;
  border-top: 1px solid #e8ddcf;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
}

.account-actions button {
  background: #2d5b53;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 16px;
}

.account-actions a {
  color: #1f4f47;
  font-weight: 750;
  text-decoration: none;
}

.account-actions a:hover {
  text-decoration: underline;
}

.account-success,
.account-error {
  border: 1px solid #d9c8ad;
  border-radius: 6px;
  font-weight: 700;
  padding: 12px 16px;
}

.account-success {
  background: #f6fbf4;
  color: #26613f;
}

.account-error {
  background: #fff5f2;
  color: #9a3412;
}

.validation-summary,
.field-validation {
  color: #9a3412;
  font-weight: 700;
}

.validation-summary ul {
  margin: 0;
  padding-left: 20px;
}

.draft-status-panel {
  margin-top: 0;
}

.draft-action-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.draft-action-grid article {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 14px;
}

.draft-action-grid h3 {
  font-size: 1rem;
  font-weight: 760;
  margin: 0 0 8px;
}

.draft-action-grid p {
  color: #4f4a42;
  line-height: 1.7;
  margin: 0;
}

.draft-workbench-page {
  margin-left: calc(50% - 50vw + 24px);
  margin-right: calc(50% - 50vw + 24px);
  padding: 0 24px;
}

.draft-workbench {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 340px minmax(0, 1fr) 320px;
}

.draft-tree-panel,
.draft-side-panel {
  max-height: calc(100vh - 140px);
  overflow: auto;
  position: sticky;
  top: 16px;
}

.draft-editor-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.draft-selected-card {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
}

.draft-form-grid {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.draft-form-card {
  margin: 0;
}

.draft-form-card h2 {
  border-bottom: 1px solid #e8ddcf;
  padding-bottom: 12px;
}

.draft-side-panel {
  display: grid;
  gap: 14px;
}

.draft-side-panel > section {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  padding: 16px;
}

.draft-side-panel h2 {
  font-size: 1.08rem;
  font-weight: 760;
  margin: 0 0 12px;
}

.draft-candidate-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.draft-candidate-form label {
  display: grid;
  gap: 6px;
}

.draft-candidate-form span {
  color: #4b463f;
  font-weight: 650;
}

.draft-candidate-form input {
  border: 1px solid #c9bba7;
  border-radius: 6px;
  min-height: 40px;
  padding: 7px 10px;
}

.draft-candidate-form button {
  background: #2d5b53;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  min-height: 40px;
}

.draft-similar-list,
.draft-list {
  display: grid;
  gap: 10px;
}

.draft-similar-list article,
.draft-list article {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 12px;
}

.draft-similar-list strong,
.draft-list strong {
  color: #1f4f47;
  display: block;
  font-weight: 760;
}

.draft-similar-list p {
  color: #4f4a42;
  line-height: 1.65;
  margin: 8px 0;
}

.draft-similar-list a {
  color: #1f4f47;
  font-weight: 700;
  text-decoration: none;
}

.draft-list span {
  background: #eef5f2;
  border: 1px solid #c7d9d2;
  border-radius: 999px;
  color: #1f4f47;
  display: inline-block;
  font-size: 0.86rem;
  font-weight: 760;
  margin: 8px 0;
  padding: 3px 8px;
}

.draft-list small {
  color: #716b60;
  display: block;
  line-height: 1.5;
}

.draft-quality-list {
  color: #4f4a42;
  line-height: 1.7;
  margin: 0;
  padding-left: 20px;
}

.draft-saved-message {
  margin: 0;
}

.pedigree-page {
  display: grid;
  gap: 18px;
  margin: 24px calc(50% - 50vw + 24px);
  padding: 0 24px;
}

.pedigree-header {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
}

.pedigree-form {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  padding: 16px;
}

.pedigree-workbench {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.pedigree-tree-panel,
.pedigree-main-panel > section {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 8px;
}

.pedigree-tree-panel {
  max-height: calc(100vh - 140px);
  overflow: auto;
  position: sticky;
  top: 16px;
}

.pedigree-panel-head {
  background: #f3eadb;
  border-bottom: 1px solid #ded6c8;
  padding: 14px 16px;
}

.pedigree-panel-head h2 {
  font-size: 1.06rem;
  font-weight: 760;
  margin: 0;
}

.pedigree-panel-head span {
  color: #716b60;
  display: block;
  margin-top: 4px;
}

.pedigree-tree-tools,
.pedigree-chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pedigree-tree-tools button,
.pedigree-chart-tools button {
  background: #fffdf8;
  border: 1px solid #c9bba7;
  border-radius: 6px;
  color: #1f4f47;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 32px;
  padding: 5px 10px;
}

.pedigree-tree-list {
  list-style: none;
  margin: 0;
  padding: 8px;
}

.pedigree-tree-list li {
  margin: 2px 0;
}

.pedigree-tree-list li[hidden],
.pedigree-chart-tree ul[hidden] {
  display: none !important;
}

.pedigree-tree-row {
  align-items: baseline;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #25221d;
  display: grid;
  gap: 2px 6px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  padding: 6px 8px;
  padding-left: calc(8px + var(--depth) * 18px);
  position: relative;
}

.pedigree-tree-row a {
  color: inherit;
  display: grid;
  gap: 2px 6px;
  grid-template-columns: minmax(0, 1fr) auto;
  text-decoration: none;
}

.pedigree-tree-row::before {
  background: #c7b58e;
  content: "";
  height: 1px;
  left: calc(9px + var(--depth) * 18px);
  position: absolute;
  top: 50%;
  width: 12px;
}

.pedigree-tree-list li.active .pedigree-tree-row,
.pedigree-tree-list li.selected-path .pedigree-tree-row,
.pedigree-tree-row:hover {
  background: #eef5f2;
  border-color: #c7d9d2;
}

.tree-toggle,
.chart-toggle {
  align-items: center;
  background: #eef0ea;
  border: 1px solid #cbd1c2;
  border-radius: 4px;
  color: #7a4e2b;
  display: inline-flex;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  padding: 0;
  width: 22px;
}

.tree-toggle:disabled,
.chart-toggle:disabled {
  background: transparent;
  border-color: transparent;
  color: #716b60;
}

.pedigree-tree-list strong {
  color: #1f4f47;
  font-size: 1.05rem;
}

.pedigree-tree-list small {
  color: #716b60;
}

.pedigree-tree-list em {
  color: #6a4b2b;
  font-style: normal;
  grid-column: 2 / -1;
}

.pedigree-main-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.pedigree-selected-card,
.pedigree-chart-section,
.pedigree-table-section {
  padding: 18px;
}

.pedigree-selected-card {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
}

.pedigree-selected-card h2 {
  font-size: 1.5rem;
  font-weight: 760;
  margin: 0;
}

.pedigree-chart-scroll,
.pedigree-table-scroll {
  overflow: auto;
}

.pedigree-chart-scroll {
  background: #eee;
  border: 1px solid #ded6c8;
  border-radius: 8px;
  margin-top: 16px;
  padding: 22px;
}

.pedigree-print-sheet {
  background: #fff;
  border: 2px solid #25221d;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.14);
  display: grid;
  grid-template-columns: 64px minmax(900px, 1fr);
  min-height: 560px;
  min-width: 1080px;
  padding: 18px;
  position: relative;
}

.pedigree-print-sheet::before,
.pedigree-print-sheet::after {
  border: 1px solid #25221d;
  content: "";
  height: 16px;
  position: absolute;
  width: 16px;
}

.pedigree-print-sheet::before {
  left: 8px;
  top: 8px;
}

.pedigree-print-sheet::after {
  bottom: 8px;
  right: 8px;
}

.pedigree-print-title {
  align-items: center;
  color: #d20f0f;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  gap: 12px;
  justify-content: center;
  letter-spacing: 0;
  writing-mode: vertical-rl;
}

.pedigree-print-title b {
  font-size: 1.3rem;
  line-height: 1;
}

.pedigree-print-inner {
  border: 1px solid #25221d;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: 18px 18px 8px;
}

.pedigree-chart-tree,
.pedigree-chart-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.pedigree-chart-tree {
  display: inline-block;
  min-width: 900px;
}

.pedigree-chart-tree ul {
  margin-left: 96px;
  padding-left: 28px;
}

.pedigree-chart-tree ul::before {
  background: #25221d;
  bottom: 28px;
  content: "";
  left: 0;
  position: absolute;
  top: 28px;
  width: 1px;
}

.pedigree-chart-tree li {
  display: flex;
  gap: 0;
  min-height: 54px;
  position: relative;
}

.pedigree-chart-tree li + li {
  margin-top: 12px;
}

.pedigree-chart-tree li::before {
  background: #25221d;
  content: "";
  height: 1px;
  left: -28px;
  position: absolute;
  top: 28px;
  width: 28px;
}

.pedigree-chart-tree > li::before {
  display: none;
}

.pedigree-chart-node-wrap {
  align-items: center;
  display: flex;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.pedigree-chart-node {
  background: #fffdf8;
  border: 1px solid #25221d;
  border-radius: 0;
  color: #25221d;
  display: grid;
  min-width: 108px;
  padding: 7px 10px;
  text-align: center;
  text-decoration: none;
}

.pedigree-chart-node.active,
.pedigree-chart-node:hover {
  background: #eef5f2;
  border-color: #1f4f47;
}

.pedigree-chart-node strong {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.12rem;
}

.pedigree-chart-node small,
.pedigree-chart-node span {
  color: #716b60;
  font-size: 0.82rem;
}

.pedigree-generation-strip {
  border-top: 1px solid #25221d;
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  margin-top: 18px;
}

.pedigree-generation-strip span {
  border-left: 1px solid #25221d;
  color: #25221d;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  padding: 4px 6px;
  text-align: center;
}

.pedigree-generation-strip span:last-child {
  border-right: 1px solid #25221d;
}

.pedigree-record-table {
  border-collapse: collapse;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  min-width: 980px;
  width: 100%;
}

.pedigree-record-table th,
.pedigree-record-table td {
  border: 1px solid #25221d;
  line-height: 1.75;
  padding: 8px 10px;
  vertical-align: top;
}

.pedigree-record-table th {
  background: #f3eadb;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-weight: 760;
}

.pedigree-record-table tr.active td {
  background: #eef5f2;
}

.pedigree-record-table a {
  color: #25221d;
  text-decoration: none;
}

.pedigree-record-table strong {
  display: block;
  font-size: 1.12rem;
}

.pedigree-record-table small {
  color: #716b60;
  display: block;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

.compact-generation-summary {
  padding: 14px 18px;
}

.genealogy-output-sheet.generation-record-list {
  background: #fff;
  border: 2px solid #25221d;
  display: grid;
  gap: 0;
  grid-template-columns: 78px minmax(980px, 1fr);
  margin-top: 14px;
  min-width: 1080px;
  padding: 16px;
  position: relative;
}

.genealogy-output-sheet::before,
.genealogy-output-sheet::after {
  border: 1px solid #25221d;
  content: "";
  height: 16px;
  position: absolute;
  width: 16px;
}

.genealogy-output-sheet::before {
  left: 10px;
  top: 10px;
}

.genealogy-output-sheet::after {
  bottom: 10px;
  right: 10px;
}

.genealogy-output-side {
  align-items: center;
  color: #d20f0f;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  gap: 18px;
  justify-content: center;
  letter-spacing: 0;
  padding: 18px 0;
  writing-mode: vertical-rl;
}

.genealogy-output-side b {
  font-size: 1.15rem;
  line-height: 1;
}

.genealogy-output-main {
  min-width: 0;
}

.genealogy-output-frame {
  border: 1px solid #25221d;
  min-height: 720px;
  padding: 0 16px 18px;
}

.genealogy-output-title {
  align-items: stretch;
  border-bottom: 1px solid #25221d;
  display: grid;
  grid-template-columns: 54px 1fr;
  margin: 0 -16px 16px;
  min-height: 64px;
}

.genealogy-output-title span {
  align-items: center;
  border-right: 1px solid #25221d;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  justify-content: center;
  writing-mode: vertical-rl;
}

.genealogy-output-title h2 {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.85rem;
  font-weight: 800;
  justify-content: center;
  margin: 0;
}

.genealogy-table-scroll {
  overflow: auto;
}

.genealogy-output-table {
  border-collapse: collapse;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  min-width: 980px;
  width: 100%;
}

.genealogy-output-table th,
.genealogy-output-table td {
  border: 1px solid #25221d;
  line-height: 1.75;
  padding: 7px 9px;
  vertical-align: top;
}

.genealogy-output-table th {
  background: #f6efe5;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-weight: 760;
  text-align: left;
}

.genealogy-output-table tr.generation-record {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin-left: 0;
  padding: 0;
}

.genealogy-output-table .generation-col {
  color: #4f4a42;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  text-align: center;
  width: 78px;
}

.genealogy-output-table .relation-col {
  color: #4f4a42;
  width: 120px;
}

.genealogy-output-table .name-col {
  font-weight: 800;
  text-align: center;
  width: 112px;
}

.genealogy-output-table .name-col a {
  color: #25221d;
  text-decoration: none;
}

.genealogy-output-table .name-col small {
  color: #716b60;
  display: block;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 2px;
}

.genealogy-output-table .text-col {
  color: #25221d;
  white-space: normal;
}

.genealogy-output-table .empty-inline {
  color: #8b8173;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.92rem;
}

.generation-page {
  margin-top: 14px;
}

.generation-header {
  align-items: end;
  gap: 12px;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, auto);
  padding: 12px 16px;
}

.generation-header h1 {
  font-size: 1.55rem;
}

.generation-header .lead-text {
  font-size: 0.94rem;
  margin-top: 6px;
}

.generation-form {
  background: #fbf6ec;
  border: 1px solid #dfd2bd;
  border-radius: 2px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) 96px 92px 76px 126px;
  padding: 10px 12px;
}

.generation-form label {
  gap: 4px;
}

.generation-form input,
.generation-form button {
  min-height: 36px;
}

.generation-form input {
  padding: 6px 9px;
}

.generation-form button {
  padding: 7px 12px;
}

.compact-generation-summary {
  margin-bottom: 8px;
  padding: 10px 14px;
}

.compact-generation-summary .result-heading h2 {
  font-size: 1.25rem;
}

.compact-generation-summary .generation-counts {
  gap: 8px;
  grid-template-columns: repeat(4, 118px);
}

.compact-generation-summary .distance-grid div {
  border-radius: 2px;
  padding: 6px 8px;
}

.generation-page-nav {
  align-items: center;
  border-top: 1px solid #dfd2bd;
  display: grid;
  gap: 10px;
  grid-template-columns: 84px minmax(0, 1fr) 84px repeat(5, 92px);
  margin-top: 10px;
  padding-top: 10px;
}

.generation-page-nav a,
.generation-page-nav span,
.generation-page-nav button {
  font-size: 0.92rem;
}

.generation-page-nav a,
.generation-page-nav button {
  border: 1px solid #cdbb9f;
  color: #17493f;
  font: inherit;
  padding: 6px 8px;
  text-align: center;
  text-decoration: none;
}

.generation-page-nav button {
  background: #7a2f13;
  border-color: #7a2f13;
  color: #fff;
  cursor: pointer;
  font-weight: 760;
  width: 100%;
}

.generation-page-nav .print-preview-link {
  background: #1f4f47;
  border-color: #1f4f47;
  color: #fff;
  font-weight: 760;
}

.generation-page-nav a.disabled {
  color: #9a8f80;
  pointer-events: none;
}

.generation-page-nav span {
  color: #5d554a;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-archive-form {
  display: contents;
  margin: 0;
}

.genealogy-output-sheet.generation-record-list {
  grid-template-columns: 54px minmax(900px, 1fr);
  margin-top: 8px;
  min-width: 980px;
  padding: 10px;
}

.genealogy-output-sheet::before,
.genealogy-output-sheet::after {
  height: 14px;
  width: 14px;
}

.genealogy-output-side {
  font-size: 1rem;
  gap: 12px;
  padding: 8px 0;
}

.genealogy-output-side b {
  font-size: 1.05rem;
}

.genealogy-output-frame {
  min-height: 620px;
  padding: 0 8px 10px;
}

.genealogy-output-title {
  grid-template-columns: 40px 1fr;
  margin: 0 -8px 8px;
  min-height: 42px;
}

.genealogy-output-title span {
  font-size: 0.9rem;
}

.genealogy-output-title h2 {
  font-size: 1.45rem;
}

.genealogy-output-table {
  font-size: 1rem;
  min-width: 880px;
}

.genealogy-output-table th,
.genealogy-output-table td {
  line-height: 1.42;
  padding: 3px 6px;
}

.genealogy-output-table th {
  padding-bottom: 4px;
  padding-top: 4px;
}

.genealogy-output-table .generation-col {
  width: 52px;
}

.genealogy-output-table .relation-col {
  text-align: center;
  width: 72px;
}

.genealogy-output-table .name-col {
  font-size: 1.06rem;
  width: 62px;
}

.genealogy-output-table .name-col small {
  font-size: 0.76rem;
  margin-top: 1px;
}

.genealogy-output-table .text-col {
  font-size: 1rem;
}

.generation-record-list .genealogy-output-title {
  display: none;
}

.generation-record-list .genealogy-table-scroll {
  overflow: auto;
}

.generation-record-list.genealogy-output-sheet {
  grid-template-columns: 76px minmax(920px, 1fr);
  padding: 12px 12px 14px;
}

.generation-record-list.genealogy-output-sheet::before,
.generation-record-list.genealogy-output-sheet::after {
  display: none;
}

.generation-record-list .sheet-corner {
  background: #fff;
  border: 1px solid #25221d;
  height: 14px;
  position: absolute;
  width: 14px;
  z-index: 2;
}

.generation-record-list .corner-tl {
  left: 10px;
  top: 10px;
}

.generation-record-list .corner-tr {
  right: 10px;
  top: 10px;
}

.generation-record-list .corner-bl {
  bottom: 10px;
  left: 10px;
}

.generation-record-list .corner-br {
  bottom: 10px;
  right: 10px;
}

.generation-record-list .genealogy-output-side {
  align-self: stretch;
  display: grid;
  font-size: 1.05rem;
  gap: 16px;
  grid-template-rows: 1fr auto auto auto 1fr;
  justify-items: center;
  line-height: 1.05;
  padding: 24px 0;
  writing-mode: horizontal-tb;
}

.generation-record-list .genealogy-output-side span,
.generation-record-list .genealogy-output-side b {
  display: block;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.generation-record-list .genealogy-output-side span:first-child {
  grid-row: 2;
}

.generation-record-list .genealogy-output-side b {
  font-size: 1.08rem;
  grid-row: 3;
}

.generation-record-list .genealogy-output-side span:last-child {
  grid-row: 4;
}

.generation-record-list .genealogy-output-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 620px;
  padding: 0 8px 10px;
}

.generation-record-list .genealogy-output-table {
  font-size: 0.98rem;
}

.generation-record-list .genealogy-output-table thead {
  display: none;
}

.generation-record-list .genealogy-output-table td {
  line-height: 1.3;
  padding: 2px 5px;
}

.generation-record-list .genealogy-output-table .generation-col,
.generation-record-list .genealogy-output-table .relation-col,
.generation-record-list .genealogy-output-table .name-col {
  text-align: center;
  vertical-align: middle;
}

.generation-record-list .genealogy-output-table .generation-col {
  color: #25221d;
  min-width: 36px;
  text-orientation: upright;
  white-space: nowrap;
  width: 36px;
  writing-mode: vertical-rl;
}

.generation-record-list .genealogy-output-table .relation-col {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  line-height: 1.12;
  min-width: 48px;
  overflow-wrap: anywhere;
  width: 48px;
  writing-mode: horizontal-tb;
}

.generation-record-list .genealogy-output-table .relation-title {
  display: block;
}

.generation-record-list .genealogy-output-table .relation-annotation-list {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  margin-top: 3px;
}

.generation-record-list .genealogy-output-table .relation-annotation {
  border: 1px solid #a63a1c;
  color: #a63a1c;
  display: inline-flex;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.66rem;
  font-weight: 760;
  line-height: 1;
  padding: 1px 2px;
}

.generation-record-list .genealogy-output-table .name-col {
  color: #16130f;
  min-width: 48px;
  padding: 2px 3px;
  width: 48px;
}

.generation-record-list .genealogy-output-table .name-col a {
  display: inline-block;
  font-size: 1.12rem;
  line-height: 1.1;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.generation-record-list .genealogy-output-table .name-col small {
  font-size: 0.68rem;
  line-height: 1;
  margin-top: 2px;
}

.generation-record-list .genealogy-output-table .text-col {
  font-size: 0.98rem;
  line-height: 1.28;
  padding-left: 8px;
}

.genealogy-output-footer {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 48px;
  margin-top: 12px;
}

.lineage-strip {
  border: 1px solid #25221d;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(28px, 1fr);
  min-height: 26px;
}

.lineage-strip span {
  align-items: center;
  border-right: 1px solid #25221d;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 0.98rem;
  justify-content: center;
  min-width: 0;
}

.lineage-strip span:last-child {
  border-right: 0;
}

.genealogy-page-number {
  color: #25221d;
  font-family: "Times New Roman", "Noto Serif SC", serif;
  font-size: 1.05rem;
  line-height: 1;
  text-align: right;
}

.body-print-preview {
  background: #e6e1d8;
}

.body-print-preview > header,
.body-print-preview > footer {
  display: none;
}

.body-print-preview .page-container {
  max-width: none;
  padding: 0;
}

.body-print-preview main {
  padding: 0 !important;
}

.print-preview-mode {
  margin: 0;
  min-height: 100vh;
  padding: 22px;
}

.print-preview-toolbar {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #d6c9b7;
  border-radius: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 auto 14px;
  max-width: 1080px;
  padding: 10px 12px;
}

.print-preview-toolbar span {
  color: #4f4a42;
  flex: 1;
  font-weight: 760;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-preview-toolbar a.disabled {
  color: #9a8f80;
  pointer-events: none;
}

.print-preview-toolbar button {
  background: #1f4f47;
  border: 1px solid #1f4f47;
  border-radius: 2px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 760;
  min-height: 36px;
  padding: 7px 13px;
}

.continuous-preview-stack {
  display: grid;
  gap: 12px;
}

.print-preview-mode .continuous-preview-stack {
  gap: 18px;
}

.print-preview-mode .genealogy-output-sheet.generation-record-list {
  box-shadow: 0 16px 38px rgba(38, 32, 22, 0.18);
  grid-template-columns: 74px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1080px;
  min-width: 0;
  width: 100%;
}

.print-preview-mode .generation-record-list .genealogy-output-frame {
  min-height: 940px;
}

.print-preview-mode .generation-record-list .genealogy-table-scroll {
  overflow: visible;
}

.print-preview-mode .generation-record-list .genealogy-output-table {
  min-width: 0;
}

.print-preview-mode .genealogy-output-footer {
  break-inside: avoid;
}

.print-preview-fill-note {
  background: #fffdf8;
  border: 1px solid #d6c9b7;
  border-radius: 2px;
  color: #5d554a;
  font-size: 0.92rem;
  line-height: 1.5;
  margin: -8px auto 10px;
  max-width: 1080px;
  padding: 8px 12px;
}

.print-preview-fill-note.is-filled {
  border-color: #c7d9d2;
  color: #1f4f47;
}

.print-preview-fill-note.has-blank-space {
  border-color: #d8a77c;
  color: #6f3e19;
}

.export-proof-panel {
  background: #fffdf8;
  border: 1px solid #d6c9b7;
  border-radius: 2px;
  margin: 10px 0 12px;
  padding: 10px 12px;
}

.print-preview-mode .export-proof-panel {
  margin: 0 auto 14px;
  max-width: 1080px;
}

.export-proof-panel header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.export-proof-panel h2 {
  font-size: 1rem;
  margin: 0;
}

.export-proof-status {
  border: 1px solid #c9b99f;
  color: #5d554a;
  font-size: 0.86rem;
  font-weight: 760;
  padding: 3px 7px;
  white-space: nowrap;
}

.export-proof-status.ready {
  border-color: #9bbcae;
  color: #1f4f47;
}

.export-proof-status.warning {
  border-color: #d8a77c;
  color: #6f3e19;
}

.export-proof-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
}

.export-proof-item {
  border: 1px solid #e2d6c5;
  min-width: 0;
  padding: 7px 8px;
}

.export-proof-item.ready {
  border-color: #c8d8d1;
}

.export-proof-item.notice {
  border-color: #d8c39b;
}

.export-proof-item.warning {
  border-color: #d8a77c;
}

.export-proof-item dt {
  color: #716b60;
  font-size: 0.78rem;
  font-weight: 760;
}

.export-proof-item dd {
  color: #25221d;
  font-size: 1rem;
  font-weight: 760;
  margin: 1px 0 0;
}

.export-proof-item small {
  color: #6c6256;
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
  margin-top: 3px;
}

.archive-save-result,
.archive-error-panel {
  background: #fffdf8;
  border: 1px solid #d6c9b7;
  border-radius: 2px;
  color: #25221d;
  margin: 10px 0 12px;
  padding: 10px 12px;
}

.print-preview-mode .archive-save-result,
.print-preview-mode .archive-error-panel {
  margin: 0 auto 14px;
  max-width: 1080px;
}

.archive-save-result header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.archive-save-result h2 {
  font-size: 1rem;
  margin: 0;
}

.archive-save-result header > span {
  border: 1px solid #c8d8d1;
  color: #1f4f47;
  font-size: 0.86rem;
  font-weight: 760;
  padding: 3px 7px;
  white-space: nowrap;
}

.archive-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-error-panel {
  border-color: #d8a77c;
  color: #6f3e19;
}

.archive-error-panel p {
  margin: 4px 0 0;
}

@media print {
  @page {
    margin: 12mm;
    size: A4 portrait;
  }

  body {
    background: #fff;
  }

  .site-header,
  .print-preview-toolbar,
  .print-preview-fill-note,
  .export-proof-panel,
  .archive-save-result,
  .archive-error-panel,
  .generation-header,
  .compact-generation-summary,
  .generation-page-nav,
  .copy-panel,
  .site-footer {
    display: none !important;
  }

  .generation-page {
    margin: 0;
    padding: 0;
  }

  .body-print-preview .page-container {
    padding: 0;
  }

  .generation-record-list.genealogy-output-sheet {
    border-color: #111;
    box-shadow: none;
    break-inside: avoid;
    margin: 0;
    min-width: 0;
    page-break-inside: avoid;
    width: 100%;
  }

  .genealogy-output-table tr,
  .genealogy-output-footer,
  .lineage-strip {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .relation-annotation {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-preview-sheet {
    break-after: page;
    page-break-after: always;
  }

  .print-preview-sheet:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }
}

.pedigree-page,
.draft-workbench-page {
  gap: 12px;
}

.draft-workbench-page {
  margin-top: 16px;
}

.pedigree-header,
.draft-header {
  align-items: end;
  gap: 14px;
  grid-template-columns: minmax(300px, 1fr) minmax(520px, auto);
  padding: 14px 18px;
}

.pedigree-header h1,
.draft-header h1 {
  font-size: 1.55rem;
}

.pedigree-header .lead-text,
.draft-header .lead-text {
  font-size: 0.96rem;
  margin-top: 6px;
}

.relationship-form.pedigree-form {
  align-items: end;
  border-radius: 2px;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) 110px 128px;
  padding: 10px 12px;
}

.relationship-form.pedigree-form label {
  gap: 4px;
}

.relationship-form.pedigree-form input,
.relationship-form.pedigree-form button {
  min-height: 36px;
}

.relationship-form.pedigree-form input {
  padding: 6px 9px;
}

.relationship-form.pedigree-form button {
  padding: 7px 12px;
}

.pedigree-workbench {
  gap: 12px;
  grid-template-columns: 430px minmax(0, 1fr);
}

.draft-workbench {
  gap: 12px;
  grid-template-columns: 430px minmax(0, 1fr) 310px;
}

.pedigree-tree-panel,
.pedigree-main-panel > section,
.draft-selected-card,
.draft-form-card,
.draft-child-strip,
.draft-side-panel > section {
  border-radius: 2px;
}

.pedigree-tree-panel {
  border-color: #c7bba9;
}

.pedigree-panel-head {
  padding: 10px 12px;
}

.pedigree-tree-column-head {
  background: #f8f3e9;
  border-bottom: 1px solid #d8ccbc;
  color: #6b5d49;
  display: grid;
  font-size: 0.82rem;
  font-weight: 760;
  grid-template-columns: minmax(118px, 1fr) 56px minmax(82px, 0.8fr);
  padding: 6px 10px 6px 54px;
}

.pedigree-tree-list {
  padding: 0;
}

.pedigree-tree-list li {
  margin: 0;
}

.pedigree-tree-row {
  align-items: center;
  border-bottom: 1px solid #e5dccf;
  border-left: 0;
  border-radius: 0;
  border-right: 0;
  border-top: 0;
  grid-template-columns: calc(24px + var(--depth) * 17px) minmax(0, 1fr);
  min-height: 36px;
  padding: 0 9px;
}

.pedigree-tree-row a {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(90px, 1fr) 56px minmax(82px, 0.8fr);
  min-height: 36px;
}

.pedigree-tree-row::before {
  background: #9f917b;
  left: calc(18px + var(--depth) * 17px);
  width: 14px;
}

.tree-toggle {
  justify-self: end;
}

.pedigree-tree-list strong,
.pedigree-tree-list em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pedigree-tree-list strong {
  font-size: 1rem;
}

.pedigree-tree-list small {
  text-align: right;
}

.pedigree-tree-list em {
  grid-column: auto;
}

.pedigree-tree-list li.active .pedigree-tree-row {
  background: #dfeee8;
  box-shadow: inset 3px 0 0 #2d5b53;
}

.pedigree-tree-list li.selected-path:not(.active) .pedigree-tree-row {
  background: #f4f9f6;
}

.pedigree-selected-card {
  gap: 12px;
  grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.28fr);
  padding: 12px 14px;
}

.pedigree-selected-card h2 {
  font-size: 1.32rem;
}

.pedigree-selected-card .record-facts div {
  border-radius: 2px;
  padding: 7px 9px;
}

.pedigree-chart-section {
  background: transparent !important;
  border: 0 !important;
  padding: 0;
}

.pedigree-chart-section > .result-heading,
.pedigree-table-section > .result-heading {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  border-radius: 2px;
  padding: 10px 14px;
}

.pedigree-chart-section > .result-heading h2,
.pedigree-table-section > .result-heading h2 {
  font-size: 1.18rem;
}

.pedigree-chart-scroll {
  background: #dedede;
  border-radius: 2px;
  margin-top: 10px;
  padding: 18px;
}

.pedigree-print-sheet {
  grid-template-columns: 82px minmax(880px, 1fr);
  min-height: 650px;
  min-width: 1040px;
  padding: 14px;
}

.pedigree-print-inner {
  grid-template-rows: auto auto 1fr auto;
  padding: 0 18px 8px;
}

.pedigree-sheet-heading {
  align-items: stretch;
  border-bottom: 1px solid #25221d;
  display: grid;
  grid-template-columns: 54px 1fr;
  margin: 0 -18px 18px;
  min-height: 58px;
}

.pedigree-sheet-heading span {
  align-items: center;
  border-right: 1px solid #25221d;
  display: inline-flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  justify-content: center;
  writing-mode: vertical-rl;
}

.pedigree-sheet-heading h3 {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.75rem;
  font-weight: 800;
  justify-content: center;
  margin: 0;
}

.pedigree-chart-tools {
  margin: 0 0 12px;
}

.pedigree-chart-tree {
  min-width: 780px;
}

.pedigree-chart-tree ul {
  margin-left: 76px;
}

.pedigree-table-section {
  background: #fff !important;
  border-color: #25221d !important;
  border-radius: 0 !important;
  padding: 12px;
}

.draft-selected-card {
  padding: 12px 14px;
}

.draft-child-strip {
  background: #fffdf8;
  border: 1px solid #ded6c8;
  padding: 12px;
}

.compact-section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.compact-section-head h2 {
  font-size: 1.05rem;
  font-weight: 760;
  margin: 0;
}

.draft-child-table-scroll {
  overflow: auto;
}

.draft-child-table {
  border-collapse: collapse;
  font-size: 0.92rem;
  width: 100%;
}

.draft-child-table th,
.draft-child-table td {
  border: 1px solid #cfc1ad;
  line-height: 1.55;
  padding: 6px 8px;
  vertical-align: top;
}

.draft-child-table th {
  background: #f3eadb;
  font-weight: 760;
}

.draft-child-table a {
  color: #1f4f47;
  font-weight: 760;
  text-decoration: none;
}

.draft-form-card {
  gap: 14px;
  padding: 16px;
}

.draft-form-card .account-fields {
  gap: 10px;
}

.draft-form-card .account-fields textarea {
  min-height: 88px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

@media (max-width: 900px) {
  .home-shell,
  .query-panel,
  .chain-grid,
  .people-grid,
  .detail-header,
  .relation-list,
  .search-header,
  .search-result-row,
  .generation-header,
  .generation-record-head,
  .archive-header,
  .archive-grid,
  .publication-list,
  .branch-map-header,
  .highlights-header,
  .admin-header,
  .admin-kpi-grid,
  .account-header,
  .draft-header,
  .draft-action-grid,
  .pedigree-header,
  .pedigree-workbench,
  .pedigree-selected-card,
  .draft-workbench,
  .draft-form-grid,
  .output-profile-form {
    grid-template-columns: 1fr;
  }

  .pedigree-tree-panel,
  .draft-tree-panel,
  .draft-side-panel {
    max-height: none;
    position: static;
  }

  .highlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cover-figure {
    max-height: 260px;
  }

  .output-word-strip {
    grid-auto-flow: row;
    grid-auto-rows: 30px;
  }

  .output-word-strip span {
    border-bottom: 1px solid #25221d;
    border-right: 0;
  }

  .output-word-strip span:last-child {
    border-bottom: 0;
  }

  .export-proof-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .page-container {
    padding: 0 14px;
  }

  .query-panel,
  .result-band {
    padding: 18px;
  }

  .query-copy h1 {
    font-size: 1.8rem;
  }

  .result-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .person-search-form {
    grid-template-columns: 1fr;
  }

  .search-page-form,
  .search-facts,
  .archive-summary div,
  .archive-facts,
  .account-fields {
    grid-template-columns: 1fr;
  }

  .distance-grid {
    grid-template-columns: 1fr;
  }

  .person-card dl div {
    grid-template-columns: 1fr;
  }

  .detail-header,
  .detail-section {
    padding: 18px;
  }

  .detail-header h1 {
    font-size: 1.7rem;
  }

  .detail-facts div {
    grid-template-columns: 1fr;
  }

  .generation-page {
    margin-left: calc(50% - 50vw + 14px);
    margin-right: calc(50% - 50vw + 14px);
    padding: 0 14px;
  }

  .generation-counts,
  .record-facts {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .export-proof-grid {
    grid-template-columns: 1fr;
  }

  .generation-record {
    margin-left: 0;
    padding: 14px;
  }

  .branch-map-page {
    margin-left: calc(50% - 50vw + 14px);
    margin-right: calc(50% - 50vw + 14px);
    padding: 0 14px;
  }

  .pedigree-page {
    margin-left: calc(50% - 50vw + 14px);
    margin-right: calc(50% - 50vw + 14px);
    padding: 0 14px;
  }

  .draft-workbench-page {
    margin-left: calc(50% - 50vw + 14px);
    margin-right: calc(50% - 50vw + 14px);
    padding: 0 14px;
  }

  .branch-map-stage {
    height: 68vh;
    min-height: 320px;
  }

  .branch-map-toolbar {
    align-items: stretch;
  }

  .highlight-grid {
    grid-template-columns: 1fr;
  }

  .admin-filter-panel,
  .admin-table-section {
    padding: 16px;
  }

  .spouse-strip {
    display: grid;
  }

  .descendant-item {
    grid-template-columns: 1fr;
  }

  .descendant-item.depth-2,
  .descendant-item.depth-3 {
    margin-left: 0;
  }
}

/* Final phase overrides: keep function pages compact, direct and tree-first. */
.navbar-nav .nav-link.is-active {
  background: #f4eadb !important;
  border-color: #d9c8b0 !important;
  color: var(--lu-green) !important;
}

@media (min-width: 1181px) {
  .page-container {
    max-width: 1720px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-page,
  .relationship-page,
  .pedigree-page,
  .draft-workbench-page {
    margin-left: calc(50% - 50vw + 16px) !important;
    margin-right: calc(50% - 50vw + 16px) !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .search-page,
  .relationship-page {
    display: grid;
    gap: 12px;
  }

  .search-page .detail-header,
  .relationship-page > .detail-header,
  .pedigree-header {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(360px, 1fr) minmax(520px, auto) !important;
    padding: 10px 14px !important;
  }

  .search-page-form {
    align-items: end;
    grid-template-columns: minmax(220px, 1fr) 110px !important;
    margin: 0;
  }

  .relation-page-form {
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 140px !important;
  }

  .pedigree-workbench {
    grid-template-columns: 420px minmax(0, 1fr) !important;
    height: calc(100vh - 142px);
    min-height: 680px;
  }

  .pedigree-tree-panel {
    max-height: none !important;
    position: static !important;
  }

  .pedigree-main-panel {
    max-height: 100%;
    overflow: auto;
  }

  .pedigree-chart-scroll {
    height: min(58vh, 680px);
  }

  .generation-page:not(.print-preview-mode) {
    align-items: start;
    display: grid !important;
    gap: 12px;
    grid-template-columns: minmax(980px, 1fr) 340px !important;
    margin: 12px calc(50% - 50vw + 16px) !important;
    padding: 0 16px !important;
  }

  .generation-page:not(.print-preview-mode) .continuous-preview-stack {
    grid-column: 1 !important;
    grid-row: 1 / span 8 !important;
  }

  .generation-page:not(.print-preview-mode) .generation-header,
  .generation-page:not(.print-preview-mode) .compact-generation-summary,
  .generation-page:not(.print-preview-mode) .export-proof-panel,
  .generation-page:not(.print-preview-mode) .archive-save-result,
  .generation-page:not(.print-preview-mode) .archive-error-panel,
  .generation-page:not(.print-preview-mode) .copy-panel {
    grid-column: 2 !important;
    margin: 0 !important;
  }

  .generation-page:not(.print-preview-mode) .generation-header {
    display: block !important;
    padding: 12px !important;
    position: sticky;
    top: 66px;
    z-index: 4;
  }

  .generation-page:not(.print-preview-mode) .generation-form {
    grid-template-columns: 1fr 1fr !important;
    margin-top: 10px;
  }

  .generation-page:not(.print-preview-mode) .generation-form label:first-child,
  .generation-page:not(.print-preview-mode) .generation-form button {
    grid-column: 1 / -1;
  }

  .generation-page:not(.print-preview-mode) .generation-page-nav,
  .generation-page:not(.print-preview-mode) .compact-generation-summary .generation-counts,
  .generation-page:not(.print-preview-mode) .export-proof-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .generation-page:not(.print-preview-mode) .generation-page-nav span {
    grid-column: 1 / -1;
    order: -1;
  }

  .generation-page:not(.print-preview-mode) .genealogy-output-sheet.generation-record-list {
    margin-top: 0;
    min-width: 0;
    width: 100%;
  }

  .generation-page:not(.print-preview-mode) .generation-record-list .genealogy-output-table {
    min-width: 0;
  }
}

@media (max-width: 1180px) {
  .search-page .detail-header,
  .relationship-page > .detail-header,
  .pedigree-header,
  .pedigree-workbench,
  .generation-page:not(.print-preview-mode),
  .search-result-row {
    grid-template-columns: 1fr !important;
  }

  .pedigree-workbench {
    height: auto;
  }

  .generation-page:not(.print-preview-mode) .generation-header,
  .generation-page:not(.print-preview-mode) .compact-generation-summary,
  .generation-page:not(.print-preview-mode) .export-proof-panel,
  .generation-page:not(.print-preview-mode) .archive-save-result,
  .generation-page:not(.print-preview-mode) .archive-error-panel,
  .generation-page:not(.print-preview-mode) .copy-panel,
  .generation-page:not(.print-preview-mode) .continuous-preview-stack {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
}

/* Query workbench refinement: tree-first lookup pages. */
header .navbar {
  position: sticky;
  top: 0;
  z-index: 30;
}

.navbar .container-fluid {
  max-width: none !important;
}

.navbar-brand,
.navbar-nav .nav-link {
  white-space: nowrap;
}

.compact-query-header {
  border-radius: 0 !important;
  margin-bottom: 10px !important;
  padding: 10px 12px !important;
}

.compact-query-header h1 {
  font-size: 1.38rem !important;
  margin-bottom: 3px !important;
}

.compact-query-header .lead-text {
  font-size: 0.94rem !important;
  margin: 0 !important;
}

.compact-search-form,
.compact-relation-form {
  gap: 8px !important;
}

.compact-search-form {
  grid-template-columns: minmax(220px, 1fr) 118px 112px 92px !important;
}

.compact-relation-form {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 96px 96px !important;
}

.compact-search-form label,
.compact-relation-form label {
  gap: 3px !important;
}

.compact-search-form input,
.compact-search-form select,
.compact-relation-form input {
  min-height: 34px !important;
  padding: 6px 8px !important;
}

.compact-search-form select {
  background: #fffefa;
  border: 1px solid #c8b99e;
  border-radius: 6px;
  color: #2f251b;
}

.compact-search-form button,
.compact-relation-form button {
  min-height: 34px !important;
  padding: 6px 10px !important;
}

.search-utility-panel {
  align-items: center;
  background: #fffdf7;
  border: 1px solid #c8b99e;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: -6px 0 10px;
  padding: 7px 10px;
}

.search-common-ancestor-form {
  align-items: end;
  display: grid;
  gap: 6px;
  grid-template-columns: auto minmax(120px, 160px) minmax(120px, 160px) auto;
}

.search-common-ancestor-form strong {
  align-self: center;
  color: #5a1a17;
  font-size: 13px;
  white-space: nowrap;
}

.search-common-ancestor-form label {
  display: grid;
  gap: 2px;
}

.search-common-ancestor-form span {
  color: #665d52;
  font-size: 11px;
  font-weight: 800;
}

.search-common-ancestor-form input {
  background: #fffefa;
  border: 1px solid #c8b99e;
  border-radius: 4px;
  min-height: 30px;
  padding: 4px 7px;
}

.search-common-ancestor-form button,
.search-utility-panel nav a {
  background: #fffefa;
  border: 1px solid #9e8869;
  border-radius: 4px;
  color: #5a1a17;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  padding: 5px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.search-utility-panel nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.query-tree-workbench {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 410px minmax(0, 1fr);
}

.query-tree-panel {
  border-radius: 0 !important;
  max-height: calc(100vh - 120px) !important;
  min-height: calc(100vh - 148px);
  position: sticky !important;
  top: 64px;
}

.query-tree-panel .pedigree-panel-head {
  padding: 10px 12px !important;
}

.query-tree-panel .pedigree-panel-head h2 {
  font-size: 1.12rem !important;
}

.query-tree-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.query-tree-main > section {
  border-radius: 0 !important;
  margin: 0 !important;
}

.query-selected-card {
  padding: 12px !important;
}

.query-selected-card h2 {
  font-size: 1.35rem !important;
}

.query-chart-section {
  padding: 10px !important;
}

.query-chart-section .result-heading {
  margin-bottom: 8px !important;
}

.query-chart-section .pedigree-chart-scroll {
  height: min(42vh, 420px) !important;
}

.query-chart-section .pedigree-print-sheet {
  min-width: 860px;
  padding: 10px !important;
}

.query-chart-section .pedigree-print-inner {
  padding: 10px 12px !important;
}

.query-chart-section .pedigree-chart-tree li {
  min-height: 42px !important;
}

.query-chart-section .pedigree-chart-tree li + li {
  margin-top: 6px !important;
}

.query-chart-section .pedigree-chart-node {
  min-width: 104px !important;
  padding: 4px 7px !important;
}

.query-chart-section .pedigree-chart-node strong {
  font-size: 1rem !important;
}

.compact-results-band {
  padding: 10px !important;
}

.compact-search-results {
  display: grid;
  gap: 7px;
}

.compact-search-results .search-result-row {
  border-radius: 0 !important;
  gap: 8px !important;
  grid-template-columns: minmax(210px, 0.9fr) minmax(300px, 1.1fr) !important;
  padding: 8px 10px !important;
}

.compact-search-results .search-result-row.active {
  background: #eef5f2 !important;
  box-shadow: inset 3px 0 0 #2d5b53;
}

.compact-search-results .search-person-main h2 {
  font-size: 1.12rem !important;
  margin-bottom: 2px !important;
}

.compact-search-results .search-person-main p {
  margin-bottom: 4px !important;
}

.compact-search-results .search-facts {
  gap: 4px 8px !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.compact-search-results .search-facts div {
  padding: 4px 6px !important;
}

.compact-search-results .result-actions {
  grid-column: 1 / -1;
}

.relation-distance-grid {
  margin-top: 8px;
}

.compact-path-panel {
  padding: 10px 12px !important;
}

.compact-path-panel h2 {
  font-size: 1.12rem !important;
  margin-bottom: 8px !important;
}

.relation-chain-grid {
  gap: 10px !important;
}

.relation-chain-grid h3 {
  font-size: 0.98rem !important;
  margin-bottom: 6px !important;
}

.chain-list {
  gap: 5px !important;
}

.chain-list li {
  border-radius: 0 !important;
  padding: 4px 7px !important;
}

.generation-page:not(.print-preview-mode) .genealogy-output-table td {
  line-height: 1.22 !important;
  padding: 1px 4px !important;
}

.generation-page:not(.print-preview-mode) .generation-record-list .genealogy-output-frame {
  min-height: 560px !important;
}

@media (max-width: 1180px) {
  .compact-search-form,
  .compact-relation-form,
  .query-tree-workbench,
  .compact-search-results .search-result-row {
    grid-template-columns: 1fr !important;
  }

  .query-tree-panel {
    max-height: none !important;
    min-height: 0;
    position: static !important;
  }

  .query-chart-section .pedigree-chart-scroll {
    height: 420px !important;
  }
}

/* Puwei refinement v2: denser left trees, printed-sheet chart, tighter generation records. */
.pedigree-tree-panel,
.query-tree-panel {
  background: #fff !important;
  border-color: #b9aa91 !important;
  border-radius: 0 !important;
}

.pedigree-panel-head {
  background: #eef5fb !important;
  border-bottom-color: #a9bdd3 !important;
  padding: 7px 9px !important;
}

.pedigree-panel-head .eyebrow {
  margin-bottom: 2px !important;
}

.pedigree-panel-head h2 {
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

.pedigree-panel-head span {
  font-size: 0.78rem !important;
  margin-top: 1px !important;
}

.pedigree-tree-tools,
.pedigree-chart-tools {
  gap: 4px !important;
  margin-top: 6px !important;
}

.pedigree-tree-tools button,
.pedigree-chart-tools button {
  border-radius: 0 !important;
  font-size: 0.78rem !important;
  min-height: 24px !important;
  padding: 2px 7px !important;
}

.pedigree-tree-column-head {
  background: #e4edf7 !important;
  border-bottom: 1px solid #a9bdd3 !important;
  color: #6f1c1c !important;
  font-size: 0.82rem !important;
  font-weight: 700;
  padding: 4px 8px 4px 30px !important;
  position: sticky;
  top: 0;
  z-index: 2;
}

.pedigree-tree-list {
  padding: 0 !important;
}

.pedigree-tree-list li {
  margin: 0 !important;
}

.pedigree-tree-row {
  border-bottom: 1px solid #e3ecf7 !important;
  border-radius: 0 !important;
  gap: 3px !important;
  grid-template-columns: 16px minmax(0, 1fr) !important;
  min-height: 26px;
  padding: 2px 6px !important;
  padding-left: calc(5px + var(--depth) * 18px) !important;
}

.pedigree-tree-row::before {
  background: #8ba3bd !important;
  left: calc(12px + var(--depth) * 18px) !important;
  width: 12px !important;
}

.pedigree-tree-row a {
  align-items: baseline !important;
  grid-template-columns: minmax(64px, 1fr) 54px minmax(74px, 1fr) !important;
  min-width: 0;
}

.pedigree-tree-list strong {
  color: #b11d1d !important;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1rem !important;
  line-height: 1.1;
}

.pedigree-tree-list small {
  color: #3b4d62 !important;
  font-size: 0.72rem !important;
}

.pedigree-tree-list em {
  color: #584430 !important;
  font-size: 0.82rem !important;
  grid-column: auto !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-toggle,
.chart-toggle {
  background: #e4edf7 !important;
  border-color: #9fb6cf !important;
  border-radius: 2px !important;
  color: #1f4f47 !important;
  font-size: 0.72rem !important;
  height: 16px !important;
  width: 16px !important;
}

.pedigree-tree-list li.active .pedigree-tree-row {
  background: #cbdff5 !important;
  box-shadow: inset 3px 0 0 #2c5a84 !important;
}

.pedigree-tree-list li.selected-path:not(.active) .pedigree-tree-row {
  background: #f4f8fd !important;
}

.pedigree-chart-scroll {
  background: #dedede !important;
  border-radius: 0 !important;
  padding: 12px !important;
}

.pedigree-print-sheet {
  box-shadow: 0 0 0 1px #111, 0 10px 24px rgba(0, 0, 0, 0.14) !important;
  grid-template-columns: 56px minmax(760px, 1fr) !important;
  min-height: 640px !important;
  min-width: 930px !important;
  padding: 14px !important;
}

.pedigree-print-sheet::before,
.pedigree-print-sheet::after {
  display: none !important;
}

.pedigree-print-sheet .sheet-corner {
  background: #fff;
  border: 1px solid #111;
  height: 14px;
  position: absolute;
  width: 14px;
  z-index: 3;
}

.pedigree-print-sheet .corner-tl {
  left: 8px;
  top: 8px;
}

.pedigree-print-sheet .corner-tr {
  right: 8px;
  top: 8px;
}

.pedigree-print-sheet .corner-bl {
  bottom: 8px;
  left: 8px;
}

.pedigree-print-sheet .corner-br {
  bottom: 8px;
  right: 8px;
}

.pedigree-print-title {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif !important;
  font-size: 1.12rem !important;
  gap: 14px !important;
  line-height: 1.2 !important;
}

.pedigree-print-inner {
  border-color: #111 !important;
  grid-template-rows: auto 1fr auto !important;
  padding: 10px 12px 6px !important;
}

.pedigree-sheet-heading {
  border-bottom: 1px solid #111;
  display: grid;
  grid-template-columns: 42px 1fr;
  margin: -10px -12px 10px;
  min-height: 44px;
}

.pedigree-sheet-heading span {
  align-items: center;
  border-right: 1px solid #111;
  display: flex;
  justify-content: center;
  writing-mode: vertical-rl;
}

.pedigree-sheet-heading h3 {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.6rem;
  font-weight: 800;
  justify-content: center;
  margin: 0;
}

.pedigree-chart-tree {
  min-width: 760px !important;
}

.pedigree-chart-tree ul {
  margin-left: 66px !important;
  padding-left: 18px !important;
}

.pedigree-chart-tree ul::before {
  bottom: 18px !important;
  top: 18px !important;
}

.pedigree-chart-tree li {
  min-height: 36px !important;
}

.pedigree-chart-tree li + li {
  margin-top: 4px !important;
}

.pedigree-chart-tree li::before {
  left: -18px !important;
  top: 18px !important;
  width: 18px !important;
}

.pedigree-chart-node-wrap {
  gap: 3px !important;
}

.pedigree-chart-node {
  background: transparent !important;
  border: 0 !important;
  min-width: 68px !important;
  padding: 0 4px !important;
}

.pedigree-chart-node.active,
.pedigree-chart-node:hover {
  background: #f2f8f5 !important;
  outline: 1px solid #7da996;
}

.pedigree-chart-node strong {
  color: #16130f !important;
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
}

.pedigree-chart-node small,
.pedigree-chart-node span {
  color: #4f4a42 !important;
  font-size: 0.7rem !important;
  line-height: 1 !important;
}

.pedigree-generation-strip,
.lineage-strip {
  border-color: #111 !important;
  min-height: 24px !important;
}

.pedigree-generation-strip span,
.lineage-strip span {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif !important;
  font-size: 0.95rem !important;
  min-width: 28px;
  padding: 1px 4px !important;
}

.generation-record-list.genealogy-output-sheet {
  box-shadow: 0 0 0 1px #111 !important;
  grid-template-columns: 64px minmax(880px, 1fr) !important;
  min-width: 980px !important;
  padding: 10px 12px 12px !important;
}

.generation-record-list .genealogy-output-side {
  font-size: 1rem !important;
  gap: 12px !important;
  padding: 18px 0 !important;
}

.generation-record-list .genealogy-output-frame {
  min-height: 590px !important;
  padding: 0 6px 8px !important;
}

.generation-record-list .genealogy-output-table {
  font-size: 0.94rem !important;
  min-width: 820px !important;
}

.generation-record-list .genealogy-output-table td {
  line-height: 1.2 !important;
  padding: 1px 4px !important;
}

.generation-record-list .genealogy-output-table .generation-col {
  min-width: 30px !important;
  width: 30px !important;
}

.generation-record-list .genealogy-output-table .relation-col {
  min-width: 42px !important;
  width: 42px !important;
}

.generation-record-list .genealogy-output-table .name-col {
  min-width: 42px !important;
  width: 42px !important;
}

.generation-record-list .genealogy-output-table .name-col a {
  font-size: 1.05rem !important;
}

.generation-record-list .genealogy-output-table .text-col {
  font-size: 0.94rem !important;
  line-height: 1.22 !important;
  padding-left: 6px !important;
}

.genealogy-output-footer {
  gap: 6px !important;
  grid-template-columns: minmax(0, 1fr) 38px !important;
  margin-top: 6px !important;
}

.genealogy-page-number {
  font-size: 0.95rem !important;
}

.print-preview-mode .generation-record-list.genealogy-output-sheet {
  max-width: 980px !important;
}

/* Unified genealogy workbench: query top, tree left, person/draft center, records right. */
.workbench-page {
  display: grid;
  gap: 8px;
  margin-left: calc(50% - 50vw + 10px);
  margin-right: calc(50% - 50vw + 10px);
  padding: 0 10px 12px;
}

.workbench-query-zone {
  background: #f4eadb;
  border: 1px solid #b9aa91;
  position: sticky;
  top: 54px;
  z-index: 20;
}

.workbench-query-form {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) 96px;
  padding: 7px 8px;
}

.workbench-mode-tabs {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(4, auto);
}

.workbench-mode-tabs label {
  align-items: center;
  background: #fffdf8;
  border: 1px solid #c9bba7;
  color: #3a332b;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 4px;
  justify-content: center;
  min-height: 32px;
  padding: 4px 8px;
  white-space: nowrap;
}

.workbench-mode-tabs label.active {
  background: #dfeee8;
  border-color: #2d5b53;
  color: #1f4f47;
}

.workbench-mode-tabs input {
  margin: 0;
}

.workbench-query-panels {
  min-width: 0;
}

.workbench-query-panel {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.workbench-query-panel[hidden] {
  display: none !important;
}

.workbench-query-panel label,
.workbench-edit-form label {
  color: #584430;
  display: grid;
  font-size: 0.76rem;
  font-weight: 700;
  gap: 2px;
}

.workbench-query-panel input,
.workbench-edit-form input,
.workbench-edit-form textarea {
  border: 1px solid #b9aa91;
  border-radius: 0;
  font-size: 0.9rem;
  min-height: 30px;
  padding: 4px 7px;
}

.workbench-edit-form textarea {
  min-height: 88px;
  resize: vertical;
}

.workbench-query-submit,
.workbench-edit-form button {
  background: #1f4f47;
  border: 1px solid #173d36;
  color: #fff;
  font-weight: 760;
  min-height: 32px;
  padding: 4px 10px;
}

.workbench-alert {
  background: #fff6df;
  border: 1px solid #d8b66d;
  color: #4d3920;
  padding: 8px 10px;
}

.workbench-alert p {
  margin: 2px 0 0;
}

.workbench-alert.success {
  background: #edf7ef;
  border-color: #8dbb95;
}

.workbench-layout {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: 340px minmax(460px, 1fr) minmax(430px, 0.92fr);
  min-height: calc(100vh - 168px);
}

.workbench-layout > .pedigree-tree-panel {
  max-height: calc(100vh - 152px) !important;
  min-height: calc(100vh - 168px);
  position: sticky !important;
  top: 112px;
}

.workbench-info-panel,
.workbench-output-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.workbench-person-card,
.workbench-relation-card,
.workbench-edit-card,
.workbench-output-sheet {
  background: #fffdf8;
  border: 1px solid #b9aa91;
}

.workbench-person-card,
.workbench-relation-card,
.workbench-edit-card {
  padding: 10px 12px;
}

.workbench-person-card > header,
.workbench-edit-card > header {
  align-items: start;
  border-bottom: 1px solid #ded6c8;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: -2px 0 8px;
  padding-bottom: 7px;
}

.workbench-person-card h1 {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
}

.workbench-inline-actions,
.workbench-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.workbench-inline-actions a,
.workbench-output-actions a {
  background: #fff;
  border: 1px solid #b9aa91;
  color: #1f4f47;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 4px 8px;
  text-decoration: none;
}

.workbench-facts {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr;
  margin: 0 0 8px;
}

.workbench-facts.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workbench-facts div {
  background: #fff;
  border: 1px solid #ded6c8;
  padding: 5px 7px;
}

.workbench-facts dt {
  color: #7a4e2b;
  font-size: 0.76rem;
  font-weight: 800;
}

.workbench-facts dd {
  font-size: 0.9rem;
  margin: 0;
}

.workbench-subsection {
  border-top: 1px solid #ded6c8;
  margin-top: 8px;
  padding-top: 8px;
}

.workbench-subsection h2,
.workbench-relation-card h2,
.workbench-edit-card h2 {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.workbench-event-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.workbench-event-list li {
  background: #fff;
  border: 1px solid #ded6c8;
  display: grid;
  gap: 4px;
  grid-template-columns: 58px minmax(80px, auto) minmax(80px, auto) minmax(0, 1fr);
  padding: 4px 6px;
}

.workbench-event-list em {
  font-style: normal;
}

.workbench-profile-text {
  background: #fff;
  border: 1px solid #ded6c8;
  padding: 6px 8px;
}

.workbench-profile-text p {
  margin: 3px 0 0;
}

.workbench-edit-card header span,
.workbench-login-note {
  color: #716b60;
  font-size: 0.86rem;
}

.workbench-edit-form {
  display: grid;
  gap: 7px;
}

.workbench-edit-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workbench-output-panel {
  max-height: calc(100vh - 152px);
  overflow: auto;
  position: sticky;
  top: 112px;
}

.workbench-output-sheet {
  background: #fff;
  border: 2px solid #111;
  display: grid;
  min-width: 410px;
  padding: 8px;
}

.workbench-output-sheet > header {
  border: 1px solid #111;
  border-bottom: 0;
  display: grid;
  grid-template-columns: 36px 1fr;
  min-height: 42px;
}

.workbench-output-sheet > header span {
  align-items: center;
  border-right: 1px solid #111;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  justify-content: center;
  writing-mode: vertical-rl;
}

.workbench-output-sheet > header h2 {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.3rem;
  font-weight: 800;
  justify-content: center;
  margin: 0;
}

.workbench-output-scroll {
  overflow: auto;
}

.workbench-output-sheet .genealogy-output-table {
  font-size: 0.86rem !important;
  min-width: 580px !important;
}

.workbench-output-sheet .genealogy-output-table td {
  line-height: 1.18 !important;
  padding: 1px 3px !important;
}

.workbench-output-sheet .generation-col {
  width: 30px !important;
}

.workbench-output-sheet .relation-col {
  width: 44px !important;
}

.workbench-output-sheet .name-col {
  width: 42px !important;
}

.workbench-output-sheet .text-col {
  font-size: 0.86rem !important;
}

.workbench-output-sheet.workbench-genealogy-page {
  background: #fff;
  border: 2px solid #111;
  box-shadow: none;
  display: grid;
  gap: 0;
  grid-template-columns: 52px minmax(620px, 1fr);
  min-width: 740px;
  padding: 12px 12px 14px;
  position: relative;
}

.workbench-genealogy-page::before,
.workbench-genealogy-page::after {
  display: none;
}

.workbench-genealogy-page .sheet-corner {
  background: #fff;
  border: 1px solid #111;
  height: 14px;
  position: absolute;
  width: 14px;
  z-index: 2;
}

.workbench-genealogy-page .corner-tl {
  left: 10px;
  top: 10px;
}

.workbench-genealogy-page .corner-tr {
  right: 10px;
  top: 10px;
}

.workbench-genealogy-page .corner-bl {
  bottom: 10px;
  left: 10px;
}

.workbench-genealogy-page .corner-br {
  bottom: 10px;
  right: 10px;
}

.workbench-genealogy-page .genealogy-output-side {
  align-items: center;
  color: #d20f0f;
  display: flex;
  flex-direction: column;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.18rem;
  font-weight: 800;
  gap: 22px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1.15;
  padding: 22px 4px;
  text-align: center;
  writing-mode: vertical-rl;
}

.workbench-genealogy-page .genealogy-output-side b {
  font-size: 1.12rem;
  line-height: 1;
}

.workbench-genealogy-page .genealogy-output-main {
  min-width: 0;
}

.workbench-genealogy-page .genealogy-output-frame {
  border: 1px solid #111;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 210px);
  padding: 0 6px 7px;
}

.workbench-genealogy-page .genealogy-output-title {
  border-bottom: 1px solid #111;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  margin: 0 -6px 5px;
  min-height: 42px;
}

.workbench-genealogy-page .genealogy-output-title span {
  align-items: center;
  border-right: 1px solid #111;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  justify-content: center;
  writing-mode: vertical-rl;
}

.workbench-genealogy-page .genealogy-output-title h2 {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.36rem;
  font-weight: 800;
  justify-content: center;
  margin: 0;
}

.workbench-genealogy-page .workbench-output-scroll {
  overflow: auto;
}

.workbench-genealogy-page .genealogy-output-table {
  font-size: 0.94rem !important;
  min-width: 620px !important;
}

.workbench-genealogy-page .genealogy-output-table td {
  border-color: #111;
  line-height: 1.24 !important;
  padding: 2px 5px !important;
}

.workbench-genealogy-page .genealogy-output-table .generation-col,
.workbench-genealogy-page .genealogy-output-table .relation-col,
.workbench-genealogy-page .genealogy-output-table .name-col {
  text-align: center;
  vertical-align: middle;
}

.workbench-genealogy-page .genealogy-output-table .generation-col {
  color: #25221d;
  font-size: 0.84rem;
  width: 30px !important;
  writing-mode: vertical-rl;
}

.workbench-genealogy-page .genealogy-output-table .relation-col {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  line-height: 1.1 !important;
  width: 46px !important;
}

.workbench-genealogy-page .genealogy-output-table .relation-title {
  display: inline-block;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.workbench-genealogy-page .genealogy-output-table .name-col {
  width: 48px !important;
}

.workbench-genealogy-page .genealogy-output-table .name-col a {
  color: #111;
  display: inline-block;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.08;
  text-decoration: none;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.workbench-genealogy-page .genealogy-output-table .text-col {
  color: #111;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 0.94rem !important;
}

.workbench-genealogy-page .genealogy-output-footer {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-top: 7px;
}

.workbench-genealogy-page .lineage-word-strip {
  border: 1px solid #111;
  display: grid;
  grid-template-columns: repeat(14, minmax(24px, 1fr));
}

.workbench-genealogy-page .lineage-word-strip span {
  align-items: center;
  border-right: 1px solid #111;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  justify-content: center;
  min-height: 23px;
}

.workbench-genealogy-page .lineage-word-strip span:last-child {
  border-right: 0;
}

.workbench-genealogy-page .genealogy-page-number {
  color: #111;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 1rem;
  min-width: 24px;
  text-align: right;
}

.workbench-output-actions {
  background: #f4eadb;
  border: 1px solid #b9aa91;
  bottom: 0;
  padding: 7px 8px;
  position: sticky;
  z-index: 18;
}

@media (max-width: 1280px) {
  .workbench-query-form,
  .workbench-layout {
    grid-template-columns: 1fr;
  }

  .workbench-mode-tabs,
  .workbench-query-panel,
  .workbench-edit-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workbench-layout > .pedigree-tree-panel,
  .workbench-output-panel {
    max-height: none !important;
    min-height: 0;
    position: static !important;
  }
}

@media (max-width: 680px) {
  .workbench-mode-tabs,
  .workbench-query-panel,
  .workbench-edit-grid,
  .workbench-event-list li,
  .workbench-facts.compact {
    grid-template-columns: 1fr;
  }
}

/* Workbench v2: electronic collection cells and respectful chain direction. */
.workbench-chain-board {
  background: #fff;
  border: 1px solid #ded6c8;
  display: grid;
  gap: 0;
  margin-bottom: 8px;
}

.workbench-chain-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 7px 8px;
}

.workbench-chain-row + .workbench-chain-row {
  border-top: 1px solid #ded6c8;
}

.workbench-chain-row > strong {
  color: #7a1b16;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1rem;
}

.respect-chain {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.respect-chain li {
  align-items: baseline;
  background: #fffdf8;
  border: 1px solid #cdbd9d;
  display: inline-flex;
  gap: 4px;
  padding: 3px 7px;
  position: relative;
}

.respect-chain li + li::before {
  color: #6b5b45;
  content: "→";
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.86rem;
  left: -12px;
  position: absolute;
}

.respect-chain li.current {
  background: #dfeee8;
  border-color: #2d5b53;
  color: #1f4f47;
  font-weight: 800;
}

.respect-chain span {
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.03rem;
}

.respect-chain small {
  color: #716b60;
  font-size: 0.72rem;
}

.display-chain-row {
  align-items: start;
  grid-template-columns: 72px minmax(0, 1fr);
}

.display-chain-row p {
  color: #716b60;
  font-size: 0.82rem;
  grid-column: 2;
  margin: -2px 0 0;
}

.workbench-peer-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.peer-chip {
  background: #fff2f2;
  border: 1px solid #c99292;
  color: #7a1b16;
  display: inline-flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1.02rem;
  font-weight: 800;
  padding: 3px 8px;
}

.peer-chip.current {
  background: #fffdf8;
  border-color: #25221d;
  color: #25221d;
}

.peer-chip.empty {
  background: #f4f4f4;
  border-color: #c8c8c8;
  color: #777;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
}

.workbench-section-head {
  align-items: start;
  display: flex;
  justify-content: space-between;
}

.workbench-section-head p {
  color: #716b60;
  font-size: 0.86rem;
  margin: 2px 0 0;
}

.electronic-collection-section {
  display: grid;
  gap: 8px;
}

.electronic-info-section {
  background: #fff;
  border: 1px solid #ded6c8;
}

.electronic-info-section > header {
  background: #f6efe5;
  border-bottom: 1px solid #ded6c8;
  padding: 6px 8px;
}

.electronic-info-section h3 {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0;
}

.electronic-info-section p {
  color: #716b60;
  font-size: 0.78rem;
  margin: 2px 0 0;
}

.electronic-cell-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.electronic-cell {
  border-bottom: 1px solid #eee3d5;
  border-right: 1px solid #eee3d5;
  display: grid;
  gap: 2px;
  min-height: 66px;
  padding: 6px 8px;
}

.electronic-cell span {
  color: #7a4e2b;
  font-size: 0.76rem;
  font-weight: 800;
}

.electronic-cell strong {
  color: #25221d;
  font-size: 0.94rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.electronic-cell small {
  color: #817568;
  font-size: 0.72rem;
  line-height: 1.25;
}

.electronic-cell.missing strong {
  color: #a63a1c;
  font-weight: 800;
}

.electronic-cell.missing {
  background: #fff9f1;
}

.quality-hint-section {
  background: #fff8e8;
  border: 1px solid #dbc58d;
  padding: 8px 10px;
}

.quality-hint-section ul,
.workbench-edit-guidance ul {
  margin: 0;
  padding-left: 1.1rem;
}

.quality-hint-section li,
.workbench-edit-guidance li {
  margin: 2px 0;
}

.workbench-edit-guidance {
  background: #edf7ef;
  border: 1px solid #a8c6ad;
  padding: 8px 10px;
}

.workbench-edit-guidance h3 {
  font-size: 0.96rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.workbench-edit-guidance p {
  color: #355748;
  font-size: 0.86rem;
  margin: 0 0 4px;
}

.workbench-output-sheet .generation-record.active {
  background: #f2f8f5 !important;
  box-shadow: inset 3px 0 0 #2d5b53;
}

.workbench-output-sheet .relation-annotation-list {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  justify-content: center;
  margin-top: 2px;
}

.workbench-output-sheet .relation-annotation {
  border: 1px solid #a63a1c;
  color: #a63a1c;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.62rem;
  line-height: 1;
  padding: 0 2px;
}

@media (max-width: 1280px) {
  .electronic-cell-grid,
  .workbench-chain-row {
    grid-template-columns: 1fr;
  }

  .display-chain-row p {
    grid-column: 1;
  }
}

/* Workbench v3: compact middle info and draft editor. */
.workbench-info-panel {
  gap: 6px;
}

.workbench-person-card,
.workbench-relation-card,
.workbench-edit-card {
  padding: 6px 8px;
}

.workbench-person-card > header,
.workbench-edit-card > header {
  gap: 8px;
  margin: 0 0 5px;
  padding-bottom: 5px;
}

.workbench-person-card .eyebrow,
.workbench-person-card .person-title {
  margin-bottom: 1px;
}

.workbench-person-card h1 {
  font-size: 1.22rem;
  line-height: 1.15;
}

.workbench-inline-actions,
.workbench-output-actions {
  gap: 4px;
}

.workbench-inline-actions a,
.workbench-output-actions a {
  font-size: 0.78rem;
  padding: 2px 6px;
}

.workbench-chain-board {
  margin-bottom: 5px;
}

.workbench-chain-row,
.display-chain-row {
  gap: 5px;
  grid-template-columns: 58px minmax(0, 1fr);
  padding: 4px 6px;
}

.workbench-chain-row > strong {
  font-size: 0.88rem;
  line-height: 1.25;
}

.respect-chain {
  gap: 3px 10px;
}

.respect-chain li {
  gap: 3px;
  padding: 1px 5px;
}

.respect-chain li + li::before {
  font-size: 0.78rem;
  left: -10px;
}

.respect-chain span {
  font-size: 0.92rem;
  line-height: 1.2;
}

.respect-chain small {
  font-size: 0.66rem;
}

.display-chain-row p {
  font-size: 0.72rem;
  grid-column: 2;
  margin: -1px 0 0;
}

.workbench-peer-row {
  gap: 4px;
}

.peer-chip {
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 1px 6px;
}

.workbench-subsection {
  margin-top: 5px;
  padding-top: 5px;
}

.workbench-subsection h2,
.workbench-relation-card h2,
.workbench-edit-card h2 {
  font-size: 0.92rem;
  margin-bottom: 3px;
}

.compact-electronic-mode {
  gap: 5px;
}

.workbench-section-head p {
  font-size: 0.72rem;
  line-height: 1.25;
  margin-top: 0;
}

.electronic-info-section > header {
  align-items: baseline;
  display: flex;
  gap: 8px;
  padding: 3px 6px;
}

.electronic-info-section h3 {
  flex: 0 0 auto;
  font-size: 0.84rem;
  line-height: 1.2;
}

.electronic-info-section p {
  flex: 1 1 auto;
  font-size: 0.68rem;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.electronic-cell-grid {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}

.electronic-cell {
  align-items: start;
  gap: 1px 5px;
  grid-template-columns: 52px minmax(0, 1fr);
  min-height: 0;
  padding: 3px 5px;
}

.electronic-cell span {
  font-size: 0.68rem;
  line-height: 1.25;
}

.electronic-cell strong {
  font-size: 0.8rem;
  line-height: 1.3;
}

.electronic-cell small {
  font-size: 0.64rem;
  grid-column: 2;
  line-height: 1.15;
  max-height: 2.3em;
  overflow: hidden;
}

.quality-hint-section {
  padding: 5px 7px;
}

.quality-hint-section ul {
  display: grid;
  font-size: 0.74rem;
  gap: 1px 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.quality-hint-section li {
  margin: 0;
}

.workbench-edit-form {
  gap: 5px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workbench-edit-form label {
  font-size: 0.72rem;
}

.workbench-edit-form input,
.workbench-edit-form textarea {
  font-size: 0.82rem;
  min-height: 26px;
  padding: 2px 5px;
}

.workbench-edit-form textarea {
  min-height: 60px;
}

.workbench-edit-main,
.workbench-edit-grid,
.workbench-edit-source-grid,
.workbench-edit-guidance,
.workbench-edit-form > .text-danger {
  grid-column: 1 / -1;
}

.workbench-edit-grid,
.workbench-edit-source-grid {
  display: grid;
  gap: 5px;
}

.workbench-edit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workbench-edit-source-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workbench-edit-guidance {
  padding: 3px 6px;
}

.workbench-edit-guidance summary {
  color: #24513e;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.3;
}

.workbench-edit-guidance p {
  font-size: 0.74rem;
  line-height: 1.35;
  margin: 3px 0;
}

.workbench-edit-guidance ul {
  font-size: 0.72rem;
}

.workbench-edit-form button {
  grid-column: 2;
  justify-self: end;
  min-height: 28px;
  padding: 2px 10px;
}

@media (max-width: 1280px) {
  .electronic-cell-grid {
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  }

  .workbench-chain-row,
  .display-chain-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .display-chain-row p {
    grid-column: 2;
  }
}

@media (max-width: 680px) {
  .workbench-edit-form,
  .workbench-edit-grid,
  .workbench-edit-source-grid,
  .electronic-cell-grid,
  .workbench-chain-row,
  .display-chain-row {
    grid-template-columns: 1fr;
  }

  .display-chain-row p,
  .workbench-edit-form button {
    grid-column: 1;
  }
}

/* Workbench v4: A4-like person sheet for middle profile data. */
.a4-person-sheet {
  background: #fff;
  border: 1px solid #171717;
  color: #171717;
  display: block;
  font-family: "SimSun", "Songti SC", "KaiTi", "Microsoft YaHei", serif;
  overflow-x: auto;
  padding: 3px;
}

.a4-sheet-caption {
  align-items: center;
  border: 1px solid #171717;
  border-bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 560px;
  padding: 2px 5px;
}

.a4-sheet-caption strong {
  color: #7a1b16;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
}

.a4-sheet-caption span {
  color: #5f564c;
  font-size: 0.7rem;
}

.a4-name-table,
.a4-meta-strip {
  display: grid;
  min-width: 560px;
}

.a4-name-table {
  border-left: 1px solid #171717;
  border-top: 1px solid #171717;
  grid-template-columns: 0.95fr 1.3fr 0.8fr 0.8fr 0.8fr;
}

.a4-meta-strip {
  border-left: 1px solid #171717;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.a4-field,
.a4-meta-field {
  align-items: stretch;
  border-bottom: 1px solid #171717;
  border-right: 1px solid #171717;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 28px;
}

.a4-field span,
.a4-meta-field span {
  align-items: center;
  background: #f8f4ec;
  border-right: 1px solid #171717;
  color: #6c2d19;
  display: flex;
  font-size: 0.72rem;
  font-weight: 800;
  justify-content: center;
  line-height: 1.1;
  padding: 1px 2px;
}

.a4-field strong,
.a4-meta-field strong {
  align-items: center;
  display: flex;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 2px 5px;
}

.a4-meta-field strong {
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  font-size: 0.86rem;
  font-weight: 700;
}

.a4-field.missing strong,
.a4-meta-field.missing strong,
.a4-profile-table tr.missing td {
  color: #a63a1c;
}

.a4-profile-table {
  border-collapse: collapse;
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  font-size: 0.78rem;
  line-height: 1.28;
  min-width: 560px;
  table-layout: fixed;
  width: 100%;
}

.a4-profile-table th,
.a4-profile-table td {
  border: 1px solid #171717;
  padding: 2px 4px;
  vertical-align: top;
  word-break: break-word;
}

.a4-profile-table thead th {
  background: #f8f4ec;
  color: #6c2d19;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.a4-profile-table tbody th {
  color: #7a1b16;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  width: 42px;
}

.a4-profile-table td:nth-child(2) {
  width: 118px;
}

.a4-profile-table td:nth-child(3) {
  width: 96px;
}

.a4-profile-table .hint-col {
  color: #746b61;
  font-size: 0.68rem;
  width: 118px;
}

@media (max-width: 680px) {
  .a4-sheet-caption,
  .a4-name-table,
  .a4-meta-strip,
  .a4-profile-table {
    min-width: 520px;
  }
}

/* Target mode: generation-record editing workbench. */
.target-workbench-page {
  --target-left-width: 260px;
  --target-right-width: 430px;
  --target-editor-height: 500px;
  background: #ede9df;
  color: #1f1914;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100vh - 92px);
  min-height: 720px;
  overflow: hidden;
}

.target-workbench-page,
.target-workbench-page *,
.target-workbench-page *::before,
.target-workbench-page *::after {
  box-sizing: border-box;
}

.target-workbench-topbar {
  align-items: center;
  background: #fffdf7;
  border: 1px solid #c7b79c;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(210px, 1fr) auto auto;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.target-practical-filters {
  align-items: center;
  border-top: 1px solid #e2d6c2;
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding-top: 8px;
}

.target-common-ancestor-form {
  align-items: end;
  display: grid;
  gap: 6px;
  grid-template-columns: auto 96px 96px auto;
}

.target-common-ancestor-form strong {
  align-self: center;
  color: #5a1a17;
  font-size: 12px;
  white-space: nowrap;
}

.target-common-ancestor-form label {
  display: grid;
  gap: 2px;
}

.target-common-ancestor-form span {
  color: #665d52;
  font-size: 11px;
  font-weight: 800;
}

.target-common-ancestor-form input {
  background: #fffefa;
  border: 1px solid #c7b79c;
  border-radius: 3px;
  min-height: 27px;
  padding: 3px 6px;
}

.target-common-ancestor-form button,
.target-practical-filters nav a {
  background: #fffefa;
  border: 1px solid #9e8869;
  border-radius: 3px;
  color: #5a1a17;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 27px;
  padding: 4px 7px;
  text-decoration: none;
  white-space: nowrap;
}

.target-practical-filters nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.target-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.target-seal {
  align-items: center;
  background: #a51618;
  color: #fff;
  display: inline-flex;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  font-size: 24px;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.target-brand strong,
.target-lineage-name b,
.target-paper-title h2 {
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
}

.target-brand strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.target-brand span:not(.target-seal),
.target-query-form span,
.target-search-locator span,
.target-panel-head span,
.target-editor-head span,
.target-grid-title span,
.target-proof-head span,
.target-editor-form label > span,
.target-source-box span,
.target-special-linkage span {
  color: #665d52;
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.target-query-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 130px 130px 72px auto;
}

.target-search-locator {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 112px 190px auto;
}

.target-query-form label,
.target-search-locator label,
.target-editor-form label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.target-query-form input,
.target-search-locator input,
.target-search-locator select,
.target-editor-form input,
.target-editor-form textarea,
.target-editor-form select {
  background: #fffefa;
  border: 1px solid #c7b79c;
  border-radius: 3px;
  color: #1f1914;
  min-height: 29px;
  padding: 4px 7px;
  width: 100%;
}

.target-query-form button,
.target-search-locator button {
  background: #fffefa;
  border: 1px solid #7d6b51;
  border-radius: 3px;
  color: #1f1914;
  cursor: pointer;
  font-weight: 800;
  min-height: 29px;
  padding: 4px 8px;
  white-space: nowrap;
}

.target-editor-form input[readonly],
.target-editor-form input:disabled,
.target-editor-form textarea:disabled,
.target-editor-form select:disabled {
  background: #f4eee2;
  color: #5d5348;
}

.target-workbench-layout {
  display: grid;
  grid-template-columns: var(--target-left-width) 10px minmax(660px, 1fr) 10px var(--target-right-width);
  min-height: 0;
  overflow: hidden;
}

.target-lineage-panel,
.target-editor-panel,
.target-ledger-panel,
.target-proof-panel {
  background: #fbf8f0;
  border: 1px solid #c7b79c;
  min-height: 0;
}

.target-lineage-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.target-panel-head,
.target-editor-head,
.target-grid-title,
.target-proof-head {
  align-items: center;
  border-bottom: 1px solid #c7b79c;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 47px;
  padding: 10px 12px;
}

.target-editor-head nav,
.target-proof-head a {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.target-editor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: stretch;
}

.target-editor-head > div {
  min-width: 0;
}

.target-editor-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-editor-head nav {
  justify-self: end;
}

.target-editor-head nav a,
.target-proof-head a {
  background: #fffefa;
  border: 1px solid #9e8869;
  border-radius: 4px;
  color: #5a1a17;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 8px 10px;
  text-decoration: none;
}

.target-editor-head nav a:hover,
.target-proof-head a:hover {
  background: #e4f1e8;
  border-color: #3d7252;
  color: #214a34;
}

.target-tree-head {
  background: #eee6d8;
  border-bottom: 1px solid #c7b79c;
  color: #5c4c3a;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  grid-template-columns: minmax(0, 1fr) 66px 52px;
  padding: 6px 8px;
}

.target-lineage-list {
  list-style: none;
  margin: 0;
  overflow: auto;
  padding: 5px 6px;
}

.target-lineage-row {
  position: relative;
}

.target-lineage-row a {
  align-items: center;
  background: #fffefa;
  border: 1px solid transparent;
  border-left: 4px solid #b9a98e;
  color: inherit;
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) 66px 52px;
  margin-bottom: 2px;
  min-height: 38px;
  padding: 4px 6px 4px calc(27px + var(--depth) * 13px);
  position: relative;
  text-decoration: none;
}

.target-lineage-row a::before {
  background: #a49784;
  content: "";
  height: 27px;
  left: calc(16px + var(--depth) * 13px);
  position: absolute;
  top: 5px;
  width: 1px;
}

.target-lineage-toggle {
  align-items: center;
  background: #fffefa;
  border: 1px solid #9e8869;
  border-radius: 3px;
  color: #5a1a17;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 16px;
  justify-content: center;
  left: calc(7px + var(--depth) * 13px);
  line-height: 1;
  padding: 0;
  position: absolute;
  top: 11px;
  width: 16px;
  z-index: 2;
}

.target-lineage-toggle::before {
  content: "-";
}

.target-lineage-row.collapsed > .target-lineage-toggle::before {
  content: "+";
}

.target-lineage-row.collapsed > a {
  background: #f6efe2;
}

.target-lineage-toggle:hover,
.target-lineage-toggle:focus-visible {
  background: #e4f1e8;
  border-color: #3d7252;
  outline: 2px solid rgba(61, 114, 82, 0.28);
  outline-offset: 1px;
}

.target-lineage-toggle.placeholder {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
}

.target-lineage-toggle.placeholder::before {
  content: "";
}

.target-lineage-row:first-child a::before {
  display: none;
}

.target-lineage-row.spouse a {
  background: #fbf6ec;
  border-left-color: #78634f;
}

.target-lineage-row.active a {
  border-color: #3d7252;
  border-left-color: #a51618;
  box-shadow: 0 4px 12px rgba(42, 31, 20, 0.16);
}

.target-lineage-name b {
  color: #1f1914;
  display: block;
  font-size: 17px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-lineage-name small {
  color: #665d52;
  display: none;
  font-size: 12px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-lineage-row em,
.target-ledger-table td:last-child span {
  border: 1px solid #3d7252;
  border-radius: 999px;
  color: #3d7252;
  display: inline-flex;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  padding: 3px 5px;
}

.target-lineage-proof {
  background: #fff8e9;
  border-top: 1px solid #c7b79c;
  padding: 10px;
}

.target-lineage-proof strong {
  color: #a51618;
}

.target-lineage-proof p {
  color: #665d52;
  font-size: 12px;
  margin: 5px 0 0;
}

.target-splitter {
  align-items: center;
  background: #e4dac9;
  border: 1px solid #c4b293;
  display: flex;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  touch-action: none;
}

.target-splitter.vertical {
  cursor: col-resize;
}

.target-splitter.horizontal {
  cursor: row-resize;
}

.target-splitter span {
  background: #8d7a5e;
  border-radius: 999px;
  display: block;
}

.target-splitter.vertical span {
  height: 76px;
  width: 2px;
}

.target-splitter.horizontal span {
  height: 2px;
  width: 76px;
}

.target-splitter:hover,
.target-splitter:focus-visible {
  background: #d7c5a8;
  outline: 2px solid #a51618;
  outline-offset: -2px;
}

.target-center-panel {
  display: grid;
  grid-template-rows: minmax(300px, var(--target-editor-height)) 10px minmax(240px, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.target-editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.target-editor-form {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  min-height: 0;
}

.target-operation-strip {
  align-items: center;
  background: #f7f0e3;
  border-bottom: 1px solid #c7b79c;
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  padding: 6px 10px;
}

.target-operation-strip strong {
  color: #5a1a17;
  flex: 0 0 auto;
  font-size: 13px;
  margin-right: 3px;
}

.target-operation-strip button,
.target-row-actions button {
  background: #fffefa;
  border: 1px solid #9e8869;
  border-radius: 3px;
  color: #5a1a17;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 25px;
  padding: 4px 7px;
  white-space: nowrap;
}

.target-operation-strip button:hover,
.target-operation-strip button:focus-visible,
.target-row-actions button:hover,
.target-row-actions button:focus-visible {
  background: #e4f1e8;
  border-color: #3d7252;
  color: #214a34;
  outline: 2px solid rgba(61, 114, 82, 0.24);
  outline-offset: 1px;
}

.target-operation-strip span {
  color: #665d52;
  flex: 0 0 auto;
  font-size: 12px;
  margin-left: 5px;
}

.target-special-linkage {
  background: #fffaf0;
  border-bottom: 1px solid #c7b79c;
  color: #3b332b;
}

.target-special-linkage summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: 70px 72px minmax(0, 1fr);
  min-height: 30px;
  padding: 5px 10px;
}

.target-special-linkage summary::marker {
  color: #a51618;
}

.target-special-linkage strong {
  border: 1px solid #c7b79c;
  color: #5a1a17;
  font-size: 12px;
  font-weight: 800;
  justify-self: start;
  line-height: 1;
  padding: 4px 7px;
}

.target-special-linkage em {
  color: #665d52;
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-special-linkage-grid {
  border-top: 1px solid #ded0b8;
  display: grid;
  gap: 6px;
  grid-template-columns: 150px 150px minmax(0, 1fr);
  padding: 8px 10px;
}

.target-operation-preview {
  background: #eef5f0;
  border-bottom: 1px solid #b7cbbf;
  color: #214a34;
  display: grid;
  gap: 3px;
  grid-template-columns: 112px minmax(0, 1fr);
  padding: 7px 10px;
}

.target-operation-preview strong {
  color: #1f4f47;
  font-size: 13px;
}

.target-operation-preview p {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.target-field-grid {
  border-bottom: 1px solid #c7b79c;
  display: grid;
  gap: 6px;
  padding: 8px 10px;
}

.target-field-grid.first {
  grid-template-columns: 50px 50px 50px 82px 82px 52px minmax(98px, 1fr) minmax(104px, 1fr);
}

.target-field-grid.second {
  grid-template-columns: 70px 58px minmax(78px, 1fr) minmax(98px, 1fr) minmax(98px, 1fr) minmax(92px, 1fr) 76px;
}

.target-field-grid.third {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.target-long-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr) 190px;
  min-height: 0;
  padding: 9px 10px;
}

.target-long-fields textarea {
  font-family: "SimSun", "Songti SC", serif;
  line-height: 1.45;
  resize: none;
}

.target-source-box {
  background: #fff8e9;
  border: 1px solid #c7b79c;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.target-source-box p {
  color: #3b332b;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.target-source-box button {
  background: #a51618;
  border: 1px solid #7e1111;
  border-radius: 4px;
  color: #fff;
  font-weight: 800;
  min-height: 32px;
}

.target-ledger-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.target-grid-title p {
  color: #665d52;
  font-size: 12px;
  margin: 0;
}

.target-ledger-wrap {
  overflow: auto;
}

.target-ledger-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 2190px;
  table-layout: fixed;
  width: 2190px;
}

.target-ledger-table th,
.target-ledger-table td {
  border: 1px solid #c7b79c;
  line-height: 1.35;
  overflow: hidden;
  padding: 6px 7px;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.target-ledger-table th {
  background: #eee6d8;
  color: #5a1a17;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

.target-ledger-table col.col-id { width: 58px; }
.target-ledger-table col.col-pid { width: 58px; }
.target-ledger-table col.col-father { width: 58px; }
.target-ledger-table col.col-path { width: 118px; }
.target-ledger-table col.col-generation { width: 80px; }
.target-ledger-table col.col-word { width: 54px; }
.target-ledger-table col.col-title { width: 124px; }
.target-ledger-table col.col-name { width: 86px; }
.target-ledger-table col.col-gender { width: 50px; }
.target-ledger-table col.col-rank { width: 58px; }
.target-ledger-table col.col-parent { width: 92px; }
.target-ledger-table col.col-display { width: 112px; }
.target-ledger-table col.col-peer { width: 112px; }
.target-ledger-table col.col-spouse { width: 112px; }
.target-ledger-table col.col-birth { width: 108px; }
.target-ledger-table col.col-death { width: 108px; }
.target-ledger-table col.col-age { width: 56px; }
.target-ledger-table col.col-burial { width: 170px; }
.target-ledger-table col.col-direction { width: 90px; }
.target-ledger-table col.col-summary { width: 360px; }
.target-ledger-table col.col-status { width: 70px; }
.target-ledger-table col.col-actions { width: 156px; }

.target-ledger-table th:nth-child(9),
.target-ledger-table td:nth-child(9),
.target-ledger-table th:nth-child(10),
.target-ledger-table td:nth-child(10),
.target-ledger-table th:nth-child(17),
.target-ledger-table td:nth-child(17),
.target-ledger-table th:nth-child(21),
.target-ledger-table td:nth-child(21),
.target-ledger-table th:nth-child(22),
.target-ledger-table td:nth-child(22) {
  text-align: center;
}

.target-ledger-table tr.selected td {
  background: #fbf0dd;
  box-shadow: inset 0 1px 0 #a51618, inset 0 -1px 0 #a51618;
}

.target-ledger-table .name-cell a {
  color: #a51618;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.target-ledger-table .summary-cell {
  line-height: 1.45;
  white-space: normal;
}

.target-ledger-table .summary-cell span {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  max-height: 38px;
  overflow: hidden;
}

.target-text-link {
  border-bottom: 1px dotted rgba(165, 22, 24, 0.55);
  color: #a51618;
  font-weight: 800;
  text-decoration: none;
}

.target-text-link:hover,
.target-text-link:focus-visible {
  background: #f7eadb;
  outline: 1px solid rgba(165, 22, 24, 0.25);
  outline-offset: 1px;
}

.target-ledger-table td.target-row-actions {
  overflow: visible;
}

.target-row-actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.target-row-actions button {
  flex: 0 0 auto;
  min-height: 23px;
  padding: 3px 5px;
}

.target-ledger-table tr.target-row-shifted td {
  background: #eef5f0;
}

.target-proof-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.target-paper-page {
  background: #fffdf7;
  border: 2px solid #231b15;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  height: calc(100% - 24px);
  margin: 12px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.target-paper-side {
  align-items: center;
  border-right: 1px solid #231b15;
  color: #a51618;
  display: flex;
  flex-direction: column;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  font-size: 18px;
  font-weight: 800;
  gap: 18px;
  justify-content: center;
  padding: 22px 0;
}

.target-paper-side span,
.target-paper-side b {
  writing-mode: vertical-rl;
}

.target-paper-main {
  min-width: 0;
}

.target-paper-title {
  border-bottom: 1px solid #231b15;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  min-height: 54px;
}

.target-paper-title span {
  align-items: center;
  border-right: 1px solid #231b15;
  display: flex;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  justify-content: center;
  writing-mode: vertical-rl;
}

.target-paper-title h2 {
  align-items: center;
  display: flex;
  font-size: 23px;
  justify-content: center;
  margin: 0;
}

.target-proof-table {
  border-collapse: collapse;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  font-size: 15px;
  table-layout: fixed;
  width: 100%;
}

.target-proof-table td {
  border: 1px solid #231b15;
  line-height: 1.38;
  padding: 5px 6px;
  vertical-align: middle;
}

.target-proof-table tr.selected td {
  background: #f8f2df;
}

.target-proof-table .gen-col,
.target-proof-table .rel-col,
.target-proof-table .proof-name {
  text-align: center;
  writing-mode: vertical-rl;
}

.target-proof-table .gen-col {
  font-size: 13px;
  width: 34px;
}

.target-proof-table .rel-col {
  width: 38px;
}

.target-proof-table .proof-name {
  width: 44px;
}

.target-proof-table .proof-name a {
  color: #a51618;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.target-proof-table .proof-text {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 13px;
}

.target-proof-table .target-text-link {
  font-weight: 700;
}

.target-statusbar {
  align-items: center;
  background: #fffdf7;
  border: 1px solid #c7b79c;
  border-top: 0;
  color: #665d52;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  min-height: 30px;
  padding: 6px 12px;
}

body.target-resizing {
  user-select: none;
}

@media (max-width: 1260px) {
  .target-workbench-page {
    height: auto;
    min-height: calc(100vh - 92px);
    overflow: visible;
  }

  .target-workbench-topbar,
  .target-workbench-layout,
  .target-center-panel {
    display: block;
  }

  .target-query-form,
  .target-search-locator {
    display: grid;
    margin-top: 10px;
  }

  .target-practical-filters,
  .search-utility-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .target-common-ancestor-form,
  .search-common-ancestor-form {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .target-splitter {
    display: none;
  }

  .target-lineage-panel,
  .target-editor-panel,
  .target-ledger-panel,
  .target-proof-panel {
    margin-bottom: 10px;
  }
}

/* 2026-07-01 content-page visual takeover: align Browse/Workbench/Publish/Highlights with Home/Preface. */
body.body-workbench,
body.body-publish,
body.body-search,
body.body-highlights {
  --content-ink: #241b14;
  --content-muted: #74634f;
  --content-light-muted: #93836f;
  --content-red: #a2322b;
  --content-red-deep: #7c221e;
  --content-jade: #2f5a50;
  --content-jade-deep: #24493f;
  --content-line: #cbb58f;
  --content-soft-line: rgba(203, 181, 143, 0.58);
  --content-paper: #fbf3e5;
  --content-paper-soft: rgba(255, 249, 236, 0.72);
  --content-paper-deep: #efe0c6;
  --content-gold: #b48a46;
  background-color: #f4ead7;
  background-image:
    linear-gradient(180deg, rgba(251, 246, 236, 0.9), rgba(244, 233, 214, 0.94)),
    url("/media/home-source-motif.png");
  background-position: center top;
  background-repeat: repeat-y;
  background-size: 1920px auto;
  color: var(--content-ink);
  font-family: var(--lu-serif);
}

body.body-workbench header,
body.body-publish header,
body.body-search header,
body.body-highlights header {
  background: rgba(252, 248, 240, 0.96) !important;
  border-bottom: 1px solid rgba(178, 151, 111, 0.58) !important;
  box-shadow: 0 3px 18px rgba(56, 42, 25, 0.12) !important;
}

body.body-workbench .navbar,
body.body-publish .navbar,
body.body-search .navbar,
body.body-highlights .navbar {
  min-height: 64px;
}

body.body-workbench .navbar .container-fluid,
body.body-publish .navbar .container-fluid,
body.body-search .navbar .container-fluid,
body.body-highlights .navbar .container-fluid {
  max-width: 1640px;
  padding-left: 34px !important;
  padding-right: 34px !important;
}

body.body-workbench .navbar-brand,
body.body-publish .navbar-brand,
body.body-search .navbar-brand,
body.body-highlights .navbar-brand {
  color: #201913 !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
  font-size: 1.55rem;
  font-weight: 700;
}

body.body-workbench .navbar-brand::before,
body.body-publish .navbar-brand::before,
body.body-search .navbar-brand::before,
body.body-highlights .navbar-brand::before {
  align-items: center;
  background: #a7352b;
  border: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 246, 229, 0.86);
  color: #fff8ea;
  content: "卢";
  display: inline-flex;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
  font-size: 1.15rem;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  line-height: 30px;
  margin-right: 13px;
  padding: 0;
  vertical-align: 1px;
  width: 30px;
}

body.body-workbench .navbar-nav .nav-link,
body.body-publish .navbar-nav .nav-link,
body.body-search .navbar-nav .nav-link,
body.body-highlights .navbar-nav .nav-link {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: #251d16 !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
  font-size: 1.07rem;
  font-weight: 700;
  letter-spacing: 0;
  min-height: auto;
  padding: 8px 9px 10px;
}

body.body-workbench .navbar-nav .nav-link:hover,
body.body-workbench .navbar-nav .nav-link.is-active,
body.body-publish .navbar-nav .nav-link:hover,
body.body-publish .navbar-nav .nav-link.is-active,
body.body-search .navbar-nav .nav-link:hover,
body.body-search .navbar-nav .nav-link.is-active,
body.body-highlights .navbar-nav .nav-link:hover,
body.body-highlights .navbar-nav .nav-link.is-active {
  background: transparent !important;
  color: #8f2d27 !important;
}

body.body-workbench .navbar-nav .nav-link.is-active::after,
body.body-publish .navbar-nav .nav-link.is-active::after,
body.body-search .navbar-nav .nav-link.is-active::after,
body.body-highlights .navbar-nav .nav-link.is-active::after {
  background: #9f2f28;
  content: "";
  display: block;
  height: 2px;
  margin: 7px auto 0;
  width: 28px;
}

body.body-workbench .nav-main,
body.body-publish .nav-main,
body.body-search .nav-main,
body.body-highlights .nav-main {
  justify-content: center;
}

body.body-workbench .nav-main .nav-item,
body.body-publish .nav-main .nav-item,
body.body-search .nav-main .nav-item,
body.body-highlights .nav-main .nav-item {
  align-items: center;
  display: flex;
}

body.body-workbench .nav-main .nav-item + .nav-item::before,
body.body-publish .nav-main .nav-item + .nav-item::before,
body.body-search .nav-main .nav-item + .nav-item::before,
body.body-highlights .nav-main .nav-item + .nav-item::before {
  color: #8a7d68;
  content: "|";
  font-family: SimSun, serif;
  margin: 0 12px 0 8px;
}

body.body-workbench footer,
body.body-publish footer,
body.body-search footer,
body.body-highlights footer {
  background: #eadac0;
  border-top: 1px solid rgba(169, 143, 105, 0.45) !important;
}

body.body-workbench .page-container,
body.body-publish .page-container,
body.body-search .page-container,
body.body-highlights .page-container {
  max-width: none !important;
}

body.body-search .page-container,
body.body-highlights .page-container {
  padding: 0 !important;
}

body.body-workbench main.pb-3,
body.body-publish main.pb-3,
body.body-search main.pb-3,
body.body-highlights main.pb-3 {
  padding-bottom: 0 !important;
}

body.body-search .search-page,
body.body-highlights .highlights-page {
  margin: 24px auto 62px !important;
  width: min(1480px, calc(100vw - 112px));
}

body.body-search .detail-header,
body.body-highlights .detail-header,
body.body-search .search-utility-panel,
body.body-search .result-band,
body.body-search .query-tree-workbench,
body.body-search .pedigree-tree-panel,
body.body-search .pedigree-selected-card,
body.body-search .pedigree-chart-section,
body.body-highlights .result-band,
body.body-highlights .highlight-topics,
body.body-highlights .highlight-card,
body.body-highlights .archive-summary,
body.body-workbench .wbk-pane,
body.body-workbench .wbk-ctx,
body.body-publish .pub-card,
body.body-publish .pub-preview {
  background:
    linear-gradient(90deg, rgba(255, 250, 239, 0.8), rgba(247, 235, 213, 0.68)) !important;
  border: 1px solid var(--content-line) !important;
  border-radius: 2px !important;
  box-shadow: 0 16px 30px rgba(80, 53, 24, 0.06) !important;
}

body.body-search .detail-header,
body.body-highlights .detail-header {
  padding: 28px 34px !important;
}

body.body-search .eyebrow,
body.body-highlights .eyebrow,
body.body-workbench .wbk-ph,
body.body-publish .pub-h {
  color: var(--content-red) !important;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
}

body.body-search h1,
body.body-highlights h1,
body.body-search .result-heading h2,
body.body-highlights .highlight-card h2,
body.body-workbench .wbk-title,
body.body-publish .pub-title {
  color: var(--content-ink) !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif !important;
  font-weight: 700;
  letter-spacing: 0 !important;
}

body.body-search h1,
body.body-highlights h1 {
  font-size: clamp(2.1rem, 3.2vw, 3.25rem) !important;
  line-height: 1.18;
}

body.body-search .lead-text,
body.body-highlights .lead-text,
body.body-search .empty-note,
body.body-search .search-person-main p,
body.body-highlights .archive-note,
body.body-highlights .large-file-note,
body.body-highlights .missing-file-note,
body.body-publish .pub-note {
  color: var(--content-muted) !important;
  line-height: 1.85;
}

body.body-search .search-page-form,
body.body-search .search-common-ancestor-form,
body.body-workbench .wbk-opform,
body.body-workbench .wbk-special,
body.body-publish .pub-card {
  background: rgba(255, 249, 236, 0.62) !important;
  border: 1px solid var(--content-soft-line) !important;
  border-radius: 2px !important;
}

body.body-search .search-page-form,
body.body-search .search-common-ancestor-form {
  padding: 14px 16px !important;
}

body.body-search input,
body.body-search select,
body.body-workbench .wbk-qin,
body.body-workbench .wbk-opin,
body.body-workbench .form-control,
body.body-workbench .form-select,
body.body-publish .form-control,
body.body-publish .form-select {
  background: rgba(255, 254, 250, 0.94) !important;
  border: 1px solid #c7b79c !important;
  border-radius: 2px !important;
  color: var(--content-ink) !important;
}

body.body-search input:focus,
body.body-search select:focus,
body.body-workbench .wbk-qin:focus,
body.body-workbench .wbk-opin:focus,
body.body-workbench .form-control:focus,
body.body-workbench .form-select:focus,
body.body-publish .form-control:focus,
body.body-publish .form-select:focus {
  border-color: var(--content-red) !important;
  box-shadow: 0 0 0 0.16rem rgba(162, 50, 43, 0.14) !important;
}

body.body-search button,
body.body-search .detail-link,
body.body-search .secondary-link,
body.body-highlights .detail-link,
body.body-highlights .secondary-link,
body.body-highlights .highlight-topics a,
body.body-workbench .wbk-chip,
body.body-workbench .wbk-mini,
body.body-workbench .wbk-tbtn,
body.body-workbench .wbk-modebtn,
body.body-workbench .wbk-pill,
body.body-workbench .btn,
body.body-publish .btn {
  border-radius: 2px !important;
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0;
}

body.body-search button,
body.body-workbench .wbk-chip.k,
body.body-workbench .btn-primary,
body.body-publish .btn-primary {
  background: var(--content-ink) !important;
  border-color: var(--content-ink) !important;
  color: #fff8e8 !important;
}

body.body-search button:hover,
body.body-workbench .wbk-chip.k:hover,
body.body-workbench .btn-primary:hover,
body.body-publish .btn-primary:hover {
  background: #3b3024 !important;
  color: #fff8e8 !important;
}

body.body-search .detail-link,
body.body-search .secondary-link,
body.body-highlights .detail-link,
body.body-highlights .secondary-link,
body.body-highlights .highlight-topics a,
body.body-workbench .wbk-chip,
body.body-workbench .wbk-mini,
body.body-workbench .wbk-tbtn,
body.body-workbench .wbk-modebtn,
body.body-workbench .wbk-pill,
body.body-workbench .btn-outline-secondary,
body.body-publish .btn-outline-secondary,
body.body-publish .btn-outline-primary {
  background: rgba(255, 248, 235, 0.54) !important;
  border: 1px solid var(--content-line) !important;
  color: var(--content-ink) !important;
  text-decoration: none;
}

body.body-search .detail-link:hover,
body.body-search .secondary-link:hover,
body.body-highlights .detail-link:hover,
body.body-highlights .secondary-link:hover,
body.body-highlights .highlight-topics a:hover,
body.body-workbench .wbk-chip:hover,
body.body-workbench .wbk-mini:hover,
body.body-workbench .wbk-tbtn:hover,
body.body-workbench .wbk-modebtn:hover,
body.body-workbench .wbk-pill:hover,
body.body-publish .btn-outline-secondary:hover,
body.body-publish .btn-outline-primary:hover {
  background: #efe0c4 !important;
  border-color: #b58f55 !important;
  color: var(--content-red-deep) !important;
}

body.body-highlights .highlight-topics a.active,
body.body-workbench .wbk-chip.on,
body.body-workbench .wbk-modebtn.on,
body.body-workbench .wbk-pill.k {
  background: #faf0ea !important;
  border-color: var(--content-red) !important;
  color: var(--content-red) !important;
}

body.body-workbench .wbk,
body.body-publish .pub {
  padding: 14px 18px 18px !important;
}

body.body-workbench .wbk-top,
body.body-publish .pub-top {
  align-items: center;
  border-bottom: 1px solid var(--content-soft-line);
  border-top: 1px solid var(--content-soft-line);
  gap: 12px !important;
  margin: 0 0 12px !important;
  min-height: 52px;
  padding: 9px 4px;
}

body.body-workbench .wbk-seal,
body.body-publish .pub-seal {
  background: #a7352b !important;
  border-radius: 0 !important;
  box-shadow: inset 0 0 0 2px rgba(255, 246, 229, 0.86);
  color: #fff8ea !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
  font-size: 1.05rem !important;
  height: 30px !important;
  width: 30px !important;
}

body.body-workbench .wbk-title,
body.body-publish .pub-title {
  font-size: 1.36rem;
  line-height: 1.2;
}

body.body-workbench .wbk-querybar,
body.body-publish .pub-top .text-muted {
  color: var(--content-muted) !important;
}

body.body-workbench .wbk-body,
body.body-publish .pub-body {
  gap: 12px !important;
}

body.body-workbench .wbk-pane,
body.body-publish .pub-preview {
  padding: 9px !important;
}

body.body-workbench .wbk-ph,
body.body-publish .pub-h {
  align-items: center;
  border-bottom: 1px solid var(--content-soft-line);
  margin: 0 0 8px !important;
  min-height: 34px;
  padding: 0 4px 8px !important;
}

body.body-workbench .wbk-side,
body.body-workbench .wbk-center,
body.body-publish .pub-side,
body.body-publish .pub-preview {
  min-width: 0;
}

body.body-workbench .wbk-tree,
body.body-workbench .wbk-ledger-wrap,
body.body-publish .pub-side {
  scrollbar-color: #bba780 #f4ead7;
}

body.body-workbench .wbk-chartwrap {
  background:
    linear-gradient(180deg, rgba(252, 247, 237, 0.9), rgba(246, 235, 216, 0.92)),
    url("/media/home-source-motif.png") !important;
  background-position: center center !important;
  background-size: cover !important;
  border: 1px solid var(--content-line) !important;
  border-radius: 2px !important;
}

body.body-browse .wbk-chartwrap {
  padding: 24px !important;
}

body.body-browse .wbk-chartwrap .gd-page {
  box-shadow: 0 18px 34px rgba(80, 53, 24, 0.1);
}

body.body-workbench #wbkRight iframe,
body.body-publish .pub-preview iframe {
  background: #efe6d6 !important;
  border: 1px solid var(--content-soft-line) !important;
  border-radius: 2px !important;
}

body.body-workbench .wbk-node {
  border-radius: 2px !important;
  color: var(--content-ink);
  min-height: 24px;
}

body.body-workbench .wbk-node:hover {
  background: rgba(239, 224, 196, 0.64) !important;
}

body.body-workbench .wbk-node.sel > .wbk-name {
  background: var(--content-red) !important;
  border-radius: 2px !important;
  color: #fff8e8 !important;
}

body.body-workbench .wbk-node.catnode[data-cat="vol"] > .wbk-name,
body.body-workbench .wbk-nav #wbkNavIdx,
body.body-workbench .wbk-cur,
body.body-workbench .wbk-chartwrap a.gd-nd.gd-sel .nm,
body.body-workbench .wbk-chartwrap a.gd-nd.gd-sel {
  color: var(--content-red) !important;
}

body.body-workbench .wbk-chartwrap a.gd-nd.gd-sel {
  background: #fff4e4 !important;
  outline: 2px solid var(--content-red) !important;
  outline-offset: 2px !important;
}

body.body-workbench .wbk-chartwrap a.gd-nd.gd-lca {
  background: #edf5ee !important;
  outline: 2px solid var(--content-jade) !important;
  outline-offset: 2px !important;
}

body.body-workbench .wbk-vs,
body.body-workbench .wbk-hs {
  background: transparent !important;
}

body.body-workbench .wbk-vs i,
body.body-workbench .wbk-hs i {
  background: #b7a486 !important;
  border-radius: 999px;
}

body.body-workbench .wbk-vs:hover i,
body.body-workbench .wbk-hs:hover i {
  background: var(--content-red) !important;
}

body.body-workbench .wbk-edit,
body.body-workbench .wbk-ledger {
  background: rgba(255, 249, 236, 0.42);
}

body.body-workbench .wbk-lab,
body.body-workbench .wbk-f > span,
body.body-publish .pub-f > span {
  color: var(--content-muted) !important;
  font-weight: 800;
}

body.body-workbench .wbk-lt th,
body.body-workbench .wbk-lt td {
  border-bottom-color: var(--content-soft-line) !important;
}

body.body-workbench .wbk-lt th {
  background: #efe5d2 !important;
  color: var(--content-red-deep) !important;
  font-weight: 800 !important;
}

body.body-workbench .wbk-lt tbody tr.on td,
body.body-workbench #wbkLedger tr.on > td {
  background: #fff0df !important;
  box-shadow: inset 3px 0 0 var(--content-red);
}

body.body-search .search-utility-panel,
body.body-highlights .highlight-topics {
  align-items: center;
  padding: 14px 18px !important;
}

body.body-search .ancestor-badge,
body.body-search .search-facts div,
body.body-search .distance-grid div,
body.body-highlights .archive-summary div,
body.body-highlights .archive-facts div {
  background: rgba(255, 253, 247, 0.72) !important;
  border: 1px solid var(--content-soft-line) !important;
  border-radius: 2px !important;
}

body.body-search .ancestor-badge span,
body.body-search .search-facts dt,
body.body-highlights .archive-summary dt,
body.body-highlights .archive-facts dt {
  color: var(--content-muted) !important;
  font-weight: 800;
}

body.body-search .ancestor-badge strong,
body.body-highlights .archive-summary dd {
  color: var(--content-jade-deep) !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
}

body.body-search .query-tree-workbench {
  gap: 12px !important;
  padding: 12px !important;
}

body.body-search .pedigree-tree-panel,
body.body-search .query-tree-panel {
  background: rgba(255, 249, 236, 0.7) !important;
}

body.body-search .pedigree-chart-scroll {
  background: #efe6d6 !important;
  border: 1px solid var(--content-soft-line) !important;
  border-radius: 2px !important;
}

body.body-search .pedigree-print-sheet {
  background: #fffdf7 !important;
  border-color: #231b15 !important;
  border-radius: 0 !important;
  box-shadow: 0 18px 34px rgba(80, 53, 24, 0.08);
}

body.body-search .compact-search-results .search-result-row,
body.body-search .search-result-row {
  background: rgba(255, 249, 236, 0.62) !important;
  border: 1px solid var(--content-soft-line) !important;
  border-radius: 2px !important;
}

body.body-search .compact-search-results .search-result-row.active,
body.body-search .search-result-row.active {
  background: #fff0df !important;
  box-shadow: inset 4px 0 0 var(--content-red) !important;
}

body.body-search .search-person-main h2 a,
body.body-highlights .highlight-card h2 {
  color: var(--content-red-deep) !important;
}

body.body-highlights .highlight-grid {
  gap: 20px !important;
}

body.body-highlights .highlight-card {
  overflow: hidden;
}

body.body-highlights .highlight-media {
  background:
    linear-gradient(180deg, rgba(247, 238, 222, 0.88), rgba(239, 224, 196, 0.9)),
    url("/media/home-source-motif.png") !important;
  border-bottom: 1px solid var(--content-soft-line) !important;
}

body.body-highlights .highlight-media img,
body.body-highlights .highlight-media video {
  filter: saturate(0.92) contrast(1.02);
}

body.body-highlights .highlight-body {
  padding: 20px 22px 22px !important;
}

body.body-highlights .highlight-placeholder {
  color: var(--content-muted) !important;
}

body.body-highlights .highlight-placeholder strong {
  color: var(--content-red-deep) !important;
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif;
}

@media (max-width: 1320px) {
  body.body-workbench .navbar .container-fluid,
  body.body-publish .navbar .container-fluid,
  body.body-search .navbar .container-fluid,
  body.body-highlights .navbar .container-fluid {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  body.body-workbench .nav-main .nav-item + .nav-item::before,
  body.body-publish .nav-main .nav-item + .nav-item::before,
  body.body-search .nav-main .nav-item + .nav-item::before,
  body.body-highlights .nav-main .nav-item + .nav-item::before {
    margin: 0 7px 0 4px;
  }

  body.body-search .search-page,
  body.body-highlights .highlights-page {
    width: min(1120px, calc(100vw - 48px));
  }
}

@media (max-width: 760px) {
  body.body-workbench .navbar .container-fluid,
  body.body-publish .navbar .container-fluid,
  body.body-search .navbar .container-fluid,
  body.body-highlights .navbar .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  body.body-workbench .nav-main .nav-item + .nav-item::before,
  body.body-publish .nav-main .nav-item + .nav-item::before,
  body.body-search .nav-main .nav-item + .nav-item::before,
  body.body-highlights .nav-main .nav-item + .nav-item::before {
    content: "";
    margin: 0;
  }

  body.body-search .search-page,
  body.body-highlights .highlights-page {
    margin-top: 16px !important;
    width: min(calc(100% - 28px), 640px);
  }

  body.body-search .detail-header,
  body.body-highlights .detail-header {
    padding: 24px 20px !important;
  }

  body.body-workbench .wbk,
  body.body-publish .pub {
    padding: 10px 10px 14px !important;
  }

  body.body-workbench .wbk-top,
  body.body-publish .pub-top {
    align-items: flex-start;
    flex-direction: column;
  }

  body.body-workbench .wbk-querybar {
    justify-content: flex-start !important;
    width: 100%;
  }

  body.body-workbench .wbk-body {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body.body-workbench .wbk-pane {
    margin-bottom: 12px;
    min-height: 360px;
    width: 100% !important;
  }

  body.body-workbench .wbk-vs {
    display: none !important;
  }

  body.body-workbench #wbkLeft,
  body.body-workbench #wbkCenter,
  body.body-workbench #wbkRight {
    flex: none !important;
    max-width: none !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  body.body-browse #wbkLeft .wbk-tree {
    max-height: min(56vh, 520px);
  }

  body.body-browse .wbk-chartwrap {
    height: 68vh;
    min-height: 420px;
    padding: 12px !important;
  }

  body.body-browse #wbkRight iframe {
    min-height: 520px;
  }

  body.body-publish .pub-body {
    display: block !important;
    height: auto !important;
  }

  body.body-publish .pub-side,
  body.body-publish .pub-preview {
    margin-bottom: 12px;
  }

  body.body-highlights .highlight-grid {
    grid-template-columns: 1fr !important;
  }
}
body.body-search .search-page,
body.body-highlights .highlights-page {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
