:root {
  --bg: #f3f6f2;
  --bg-deep: #dfe8e2;
  --ink: #14201e;
  --ink-soft: #5a6661;
  --accent: #9b3328;
  --accent-soft: #c96f4a;
  --teal: #1f746b;
  --blue: #386b96;
  --gold: #a97820;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(29, 47, 43, 0.12);
  --shadow: 0 18px 44px rgba(23, 38, 34, 0.1);
  --radius: 14px;
  --page-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfcfa 0%, var(--bg) 58%, var(--bg-deep) 100%);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body.layout-narrow {
  --page-width: 760px;
}

body.layout-medium {
  --page-width: 920px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(31, 116, 107, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 116, 107, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, black 0%, transparent 92%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-glow {
  display: none;
}

.hero {
  padding: 24px 20px 10px;
}

.hero-inner,
.shell {
  width: min(var(--page-width), calc(100vw - 32px));
  margin: 0 auto;
}

.hero-inner {
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-inner::after {
  display: none;
}

.hero-inner > * {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker,
.record-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-main,
.section-head,
.record-head,
.detail-hero,
.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.hero h1,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.hero h1 {
  margin-top: 16px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.6;
}

.muted,
.excerpt {
  color: var(--ink-soft);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-height: 52px;
  padding: 8px 12px 8px 8px;
  border-radius: 16px;
  border: 1px solid rgba(31, 116, 107, 0.16);
  background: rgba(249, 252, 250, 0.86);
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

a.site-brand:hover,
a.site-brand:focus-visible {
  background: rgba(255, 252, 247, 0.98);
  border-color: rgba(31, 116, 107, 0.34);
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.12);
  transform: translateY(-1px);
}

.site-brand:focus-visible,
.top-nav a:focus-visible,
.account-link:focus-visible,
.mobile-menu-button:focus-visible,
.mobile-drawer-close:focus-visible,
.button-link:focus-visible,
.search-form button:focus-visible,
.page-link:focus-visible {
  outline: 3px solid rgba(40, 92, 84, 0.34);
  outline-offset: 3px;
}

.site-brand-current {
  cursor: default;
}

.brand-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: transparent;
  filter: drop-shadow(0 4px 10px rgba(102, 34, 28, 0.13));
}

.brand-seal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-brand strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 16px;
  background: rgba(244, 248, 245, 0.88);
  border: 1px solid var(--line);
}

.top-nav a,
.button-link,
.search-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  text-decoration: none;
  min-height: 44px;
  font-weight: 500;
  line-height: 1.2;
}

.top-nav a {
  min-width: 92px;
  white-space: nowrap;
}

.top-nav a:hover,
.button-link:hover,
.search-form button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 116, 107, 0.45);
  background: #fff;
  box-shadow: 0 6px 14px rgba(31, 116, 107, 0.11);
}

.top-nav a.active {
  background: var(--teal);
  color: #fff;
  border-color: rgba(31, 116, 107, 0.7);
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.22);
}

.top-nav a.active:hover {
  background: #1a665e;
  box-shadow: 0 10px 22px rgba(31, 116, 107, 0.28);
}

body.layout-narrow .hero-main,
body.layout-medium .hero-main {
  flex-direction: column;
}

body.layout-narrow .top-nav,
body.layout-medium .top-nav {
  width: 100%;
}

body.layout-narrow .top-nav a {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 0;
}

body.layout-medium .top-nav a {
  flex: 1 1 auto;
}

body.layout-narrow .hero h1 {
  font-size: clamp(30px, 6vw, 46px);
}

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

.account-form {
  display: flex;
  margin: 0;
}

.account-link,
.account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
}

button.account-link {
  cursor: pointer;
}

.account-link:hover,
.account-link.active {
  border-color: rgba(155, 51, 40, 0.3);
  color: var(--accent);
  background: #fff;
}

.account-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.account-link.primary:hover,
.account-link.primary.active {
  background: #84291f;
  color: #fff;
}

.account-chip {
  color: var(--teal);
  background: rgba(31, 116, 107, 0.08);
}

/* Authentication pages use a quiet, task-focused header. */
.auth-header {
  padding: 24px 20px 10px;
}

.auth-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
}

.auth-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.auth-page-actions .account-link {
  white-space: nowrap;
}

.auth-page-actions span.account-link {
  cursor: default;
}

.auth-page .shell {
  width: min(560px, calc(100vw - 32px));
  padding-top: 34px;
}

.auth-page .narrow-panel {
  width: 100%;
}

.auth-card-heading {
  display: grid;
  gap: 6px;
}

.auth-card-heading h2 {
  font-size: clamp(28px, 5vw, 38px);
}

.auth-page .primary-action {
  width: 100%;
  margin-top: 4px;
}

.mobile-menu-button,
.mobile-drawer-close {
  display: none;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 32, 30, 0.34);
  backdrop-filter: blur(4px);
}

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  width: min(86vw, 360px);
  height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  border-left: 1px solid rgba(29, 47, 43, 0.12);
  background: rgba(255, 252, 247, 0.98);
  box-shadow: -24px 0 60px rgba(20, 32, 30, 0.18);
  transform: translateX(110%);
  transition: transform 220ms ease;
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(29, 47, 43, 0.1);
}

.mobile-nav-list,
.mobile-account-panel {
  display: grid;
  gap: 8px;
}

.mobile-nav-list {
  margin-top: 14px;
}

.mobile-nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(29, 47, 43, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 650;
}

.mobile-nav-list a::after {
  content: "›";
  color: rgba(90, 102, 97, 0.75);
  font-size: 22px;
  line-height: 1;
}

.mobile-nav-list a.active {
  border-color: rgba(31, 116, 107, 0.5);
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
}

.mobile-account-panel {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(29, 47, 43, 0.1);
}

.mobile-account-panel .account-link,
.mobile-account-panel .account-chip,
.mobile-account-panel .account-form {
  width: 100%;
}

.mobile-account-panel .account-link {
  min-height: 48px;
}

.mobile-account-user {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(31, 116, 107, 0.08);
}

.mobile-account-user span {
  color: var(--ink-soft);
  font-size: 12px;
}

.mobile-account-user strong {
  color: var(--teal);
  font-size: 16px;
}

.shell {
  padding: 12px 0 52px;
}

.panel,
.record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel {
  padding: 24px;
}

.intro-panel {
  display: grid;
  gap: 22px;
}

.product-overview-panel {
  display: grid;
  gap: 22px;
}

.product-overview-head h2 {
  max-width: 620px;
  font-size: clamp(26px, 3.5vw, 40px);
  line-height: 1.16;
}

.product-overview-head .muted {
  max-width: 680px;
  margin: 12px 0 0;
  line-height: 1.7;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.service-card {
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(31, 116, 107, 0.35);
  box-shadow: 0 12px 24px rgba(31, 116, 107, 0.12);
}

.service-card span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.service-card strong {
  font-size: 20px;
}

.service-card em {
  color: var(--ink-soft);
  font-style: normal;
  line-height: 1.55;
}

.home-workbench,
.home-feature-lineage,
.home-compact-section {
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 18px 40px rgba(38, 30, 22, 0.08);
}

.home-workbench {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: end;
  padding: 22px;
}

.home-brief h2 {
  margin: 4px 0 8px;
  max-width: 520px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(30px, 4vw, 46px);
  color: var(--ink);
  line-height: 1.12;
}

.home-brief .muted {
  max-width: 560px;
  margin: 0;
  line-height: 1.7;
}

.home-search {
  display: grid;
  gap: 9px;
}

.home-search label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.home-search > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  overflow: hidden;
  border: 1px solid rgba(31, 116, 107, 0.22);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(31, 116, 107, 0.06);
}

.home-search input {
  min-width: 0;
  border: 0;
  padding: 0 16px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.home-search input:focus {
  outline: 0;
}

.home-search button {
  appearance: none;
  border: 0;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.home-quick-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.home-quick-grid a {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  text-decoration: none;
}

.home-quick-grid a:hover,
.home-quick-grid a:focus-visible {
  border-color: rgba(31, 116, 107, 0.34);
  background: rgba(31, 116, 107, 0.07);
}

.home-quick-grid span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.home-quick-grid strong {
  font-size: 17px;
}

.home-feature-lineage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 20px 22px;
}

.home-feature-lineage h3,
.home-compact-section h3 {
  margin: 2px 0 7px;
  font-size: clamp(22px, 2.8vw, 32px);
  color: var(--accent);
  line-height: 1.25;
}

.home-feature-lineage .muted {
  margin: 0;
}

.home-compact-section {
  margin-top: 14px;
  padding: 18px 22px;
}

.section-head.compact {
  align-items: center;
}

.home-news-list {
  display: grid;
  margin-top: 10px;
}

.home-news-list a {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid rgba(70, 56, 42, 0.1);
  color: var(--ink);
  text-decoration: none;
}

.home-news-list a:first-child {
  border-top: 0;
}

.home-news-list strong {
  font-size: 16px;
}

.home-news-list span {
  color: var(--ink-soft);
  font-size: 13px;
}

.home-menu-note {
  margin: 12px 4px 0;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.stat-grid,
.card-grid,
.grid.two-col,
.card-list {
  display: grid;
  gap: 18px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.stat-card {
  padding: 18px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--teal);
  opacity: 0.78;
}

.stat-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: clamp(26px, 3.8vw, 38px);
}
.stat-card.ok {
  background: rgba(46, 125, 110, 0.08);
  border-color: rgba(46, 125, 110, 0.25);
}
.stat-card.ok::before { background: #2e7d6e; }
.stat-card.ok strong { color: #2e7d6e; }
.stat-card.warn {
  background: rgba(196, 108, 20, 0.08);
  border-color: rgba(196, 108, 20, 0.25);
}
.stat-card.warn::before { background: var(--gold); }
.stat-card.warn strong { color: #b86a1a; }
.stat-card.info {
  background: rgba(80, 120, 160, 0.08);
  border-color: rgba(80, 120, 160, 0.25);
}
.stat-card.info::before { background: var(--blue); }
.stat-card.info strong { color: #4a7a9e; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 6px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.page-link {
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  transition: background 120ms ease;
}
.page-link:hover {
  background: var(--line);
}
.page-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.page-info {
  font-size: 14px;
  color: var(--ink-soft);
}

/* Filter form */
.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-form select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 14px;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.filter-check input {
  margin: 0;
}

/* Match navigation in lineage chart */
.match-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.match-nav-btn {
  padding: 5px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease;
}
.match-nav-btn:hover {
  background: var(--line);
}

/* Breadcrumb */
.breadcrumb-row {
  padding: 10px 0 4px;
  margin-bottom: -8px;
}
.breadcrumb-link {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 120ms ease;
}
.breadcrumb-link:hover {
  color: var(--ink);
}

.grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.grid.two-col.wide-left {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  margin-top: 18px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 18px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.compact-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-card,
.source-card,
.record-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

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

.mini-card strong,
.record-card h3,
.source-card h3 {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 21px;
}

.mini-card span,
.mini-card em,
.record-chip,
.alias-pill {
  font-size: 13px;
}

.record-chip,
.alias-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(155, 51, 40, 0.08);
  color: var(--accent);
}

.warn {
  background: rgba(199, 109, 75, 0.14);
}

.image-chip,
.inline-flag,
.thumbnail-flag {
  background: rgba(40, 92, 84, 0.12);
  color: #285c54;
}

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

.list-panel {
  margin-top: 18px;
  padding: 14px;
}

.list-table {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.list-head-row {
  background: rgba(31, 116, 107, 0.07);
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.person-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.person-primary strong {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 20px;
}

.list-link {
  margin-top: 0;
}

.card-thumbnail {
  position: relative;
  margin: 14px 0 12px;
}

.card-thumbnail img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.95);
}

.thumbnail-flag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.inline-flag {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 650;
}

button.button-link {
  appearance: none;
  font: inherit;
  cursor: pointer;
}

.button-link.secondary {
  margin-top: 0;
}

.image-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-toggle-button {
  margin-top: 0;
}

.search-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-form input {
  min-width: min(320px, 70vw);
  min-height: 50px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
}

.search-form input:focus,
.search-form select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.question-block input:focus,
.question-block select:focus,
.question-block textarea:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: 3px solid rgba(31, 116, 107, 0.18);
  border-color: rgba(31, 116, 107, 0.42);
}

.search-form button {
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.alias-block,
.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.person-hero-media {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.person-bio-summary {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.person-hero-media img,
.entry-snippet img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.95);
}

.person-hero-media img {
  max-height: 340px;
  object-fit: cover;
}

.entry-snippet {
  margin-top: 2px;
}

.relation-block + .relation-block,
.source-list,
.page-entry-list {
  margin-top: 18px;
}

.relation-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid var(--line);
  margin-top: 10px;
}

.source-card,
.source-meta {
  display: grid;
  gap: 10px;
}

.source-meta {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
  align-items: center;
}

.text-flow {
  line-height: 1.9;
}

.text-flow p {
  margin: 0;
}

.text-flow p + p {
  margin-top: 0.9em;
}

.text-block {
  padding: 16px;
  border-radius: 18px;
  background: rgba(244, 237, 226, 0.8);
  border: 1px solid rgba(70, 56, 42, 0.09);
  line-height: 1.85;
  word-break: break-word;
}

.large-text {
  max-height: 400px;
  overflow: auto;
}

.image-stack {
  display: grid;
  gap: 16px;
}

.image-stack img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.lineage-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-top: 18px;
  align-items: start;
}

.chart-showcase {
  display: grid;
  gap: 14px;
}

.chart-feature-card,
.lineage-card-large {
  display: grid;
  gap: 10px;
  text-decoration: none;
}

.chart-feature-card {
  padding: 20px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.chart-feature-card:hover,
.chart-feature-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(31, 116, 107, 0.35);
  box-shadow: 0 12px 24px rgba(31, 116, 107, 0.12);
}

.chart-feature-card strong,
.lineage-card-large h3 {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 24px;
}

.lineage-card-large {
  padding: 24px;
  min-height: 240px;
  background: rgba(255, 255, 255, 0.9);
}

.lineage-map-panel,
.lineage-side-panel {
  min-width: 0;
}

body.lineage-page {
  --page-width: 1500px;
}

.lineage-workbench {
  display: grid;
  gap: 14px;
}

.lineage-command {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 18px 40px rgba(38, 30, 22, 0.08);
}

.lineage-command-title {
  min-width: 0;
}

.lineage-command-title h2 {
  margin: 2px 0 4px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(24px, 2.2vw, 34px);
  color: var(--accent);
}

.lineage-command-title .muted {
  margin: 0;
  font-size: 13px;
}

.lineage-command-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 56px;
  border: 1px solid rgba(143, 45, 30, 0.16);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.lineage-command-search input {
  min-width: 0;
  border: 0;
  min-height: 56px;
  padding: 0 16px;
  background: transparent;
  font: inherit;
  color: var(--ink);
}

.lineage-command-search input:focus {
  outline: 0;
}

.lineage-command-search:focus-within {
  border-color: rgba(31, 116, 107, 0.48);
  box-shadow: 0 0 0 3px rgba(31, 116, 107, 0.13);
}

.lineage-command-search button {
  appearance: none;
  border: 0;
  border-left: 1px solid rgba(143, 45, 30, 0.12);
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.lineage-command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.lineage-workbench-grid {
  display: grid;
  grid-template-columns: minmax(250px, 292px) minmax(0, 1fr) minmax(250px, 292px);
  gap: 14px;
  align-items: start;
}

.lineage-filter-panel,
.lineage-side-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  min-width: 0;
  scrollbar-width: thin;
}

.lineage-map-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(250, 244, 234, 0.9));
  box-shadow: 0 18px 40px rgba(38, 30, 22, 0.08);
}

.lineage-tool-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 12px 30px rgba(38, 30, 22, 0.06);
}

.lineage-tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lineage-tool-head h3,
.lineage-tool-head h4 {
  margin: 0;
  font-size: 18px;
}

.lineage-tool-head.compact {
  align-items: center;
}

.lineage-tool-head.compact span {
  color: var(--ink-soft);
  font-size: 12px;
}

.lineage-match-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(70, 56, 42, 0.055);
}

.lineage-match-nav span {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lineage-mini-btn {
  appearance: none;
  border: 1px solid rgba(143, 45, 30, 0.16);
  border-radius: 10px;
  min-height: 34px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.lineage-mini-btn:hover {
  background: rgba(143, 45, 30, 0.08);
}

.lineage-empty-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(31, 116, 107, 0.055);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.lineage-empty-box strong {
  color: var(--ink);
}

.lineage-result-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.lineage-result-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.lineage-result-item:hover,
.lineage-result-item.current {
  border-color: rgba(143, 45, 30, 0.45);
  background: rgba(255, 242, 222, 0.88);
}

.lineage-result-item:hover {
  transform: translateY(-1px);
}

.lineage-result-item span,
.lineage-result-item em {
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
}

.lineage-result-item strong {
  grid-column: 1;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 18px;
  color: var(--ink);
}

.lineage-result-item b {
  grid-row: 1 / span 3;
  grid-column: 2;
  align-self: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
  font-size: 12px;
}

.lineage-generation-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.lineage-generation-item {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.lineage-generation-item:hover,
.lineage-generation-item.current {
  border-color: rgba(31, 116, 107, 0.26);
  background: rgba(31, 116, 107, 0.07);
}

.lineage-generation-item span {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 16px;
}

.lineage-generation-item strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}

.lineage-generation-item b {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.lineage-side-panel {
  position: sticky;
  top: 16px;
}

.lineage-search {
  align-items: center;
}

.lineage-canvas {
  margin-top: 12px;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at top, rgba(143,45,30,0.06), transparent 60%),
    linear-gradient(180deg, #fbf6ec 0%, #f4ecdb 100%);
  height: min(72vh, 820px);
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(70,56,42,0.06);
}

.lineage-canvas.grabbing { cursor: grabbing; }

.lineage-viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.lineage-canvas .lineage-clean-svg {
  display: block;
  width: 1280px;
  height: auto;
}

.lineage-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(143, 45, 30, 0.1);
}

.zoom-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.06);
  border: 1px solid rgba(70, 56, 42, 0.08);
}

.zoom-btn {
  appearance: none;
  border: 0;
  background: #fff;
  color: var(--accent);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(70,56,42,0.12);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.zoom-btn:hover { background: rgba(143,45,30,0.08); transform: translateY(-1px); }
.zoom-btn:active { transform: translateY(0); }

.zoom-btn.ghost {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.zoom-btn.ghost:hover { background: rgba(143,45,30,0.06); color: var(--accent); }

.zoom-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-weight: 500;
}

.hide-on-narrow { font-size: 12px; }
@media (max-width: 760px) { .hide-on-narrow { display: none; } }

.lineage-hint {
  position: absolute;
  bottom: 12px;
  right: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(40, 30, 20, 0.62);
  color: #fdf6e8;
  font-size: 12px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 380ms ease;
}
.lineage-hint.faded { opacity: 0; }

.lineage-minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 132px;
  height: min(310px, calc(100% - 28px));
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(70, 56, 42, 0.16);
  box-shadow: 0 10px 30px rgba(48, 35, 22, 0.18);
  cursor: crosshair;
  touch-action: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.lineage-generation-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(70, 56, 42, 0.1);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.82);
}

.lineage-generation-strip > span {
  color: var(--ink-soft);
  font-size: 12px;
}

.lineage-generation-strip > div {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.lineage-generation-strip button {
  appearance: none;
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 32px;
  border: 1px solid rgba(70, 56, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.lineage-generation-strip button:hover,
.lineage-generation-strip button.current {
  border-color: rgba(143, 45, 30, 0.4);
  background: rgba(143, 45, 30, 0.1);
  color: var(--accent);
}

.lineage-generation-strip button.has-match::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: middle;
}
.lineage-minimap-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.lineage-minimap-ruler {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 22px;
  background: rgba(255, 250, 242, 0.92);
  border-left: 1px solid rgba(70, 56, 42, 0.1);
  pointer-events: none;
  z-index: 2;
}
.pcard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: rgba(70, 56, 42, 0.6);
  font-size: 14px;
}
.pcard-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(143, 45, 30, 0.2);
  border-top-color: rgba(143, 45, 30, 0.85);
  border-radius: 50%;
  animation: pcard-spin 0.7s linear infinite;
}
@keyframes pcard-spin {
  to { transform: rotate(360deg); }
}
.minimap-ruler-tick {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  margin-top: -7px;
}
.minimap-ruler-tick::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 1px;
  background: rgba(70, 56, 42, 0.3);
  transform: translateY(-50%);
}
.minimap-ruler-label {
  font-size: 9px;
  line-height: 1;
  color: rgba(70, 56, 42, 0.65);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lineage-minimap-bg { fill: #fffaf0; }
.lineage-minimap-band { fill: rgba(143, 45, 30, 0.055); }
.lineage-minimap-band.alt { fill: rgba(40, 92, 84, 0.06); }
.lineage-minimap-edge {
  display: none;
}
.lineage-minimap-node {
  fill: rgba(143, 45, 30, 0.5);
  stroke: none;
  shape-rendering: crispEdges;
}
.lineage-minimap-node.is-match { fill: rgba(46, 125, 110, 0.78); }
.lineage-minimap-node.is-selected { fill: rgba(143, 45, 30, 0.95); }
.lineage-minimap-view {
  fill: rgba(255, 255, 255, 0.24);
  stroke: rgba(143, 45, 30, 0.95);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

/* ========= Generation bands ========= */
.gen-band-rect {
  fill: url(#bandFill);
  stroke: rgba(143, 45, 30, 0.16);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.gen-band.alt .gen-band-rect {
  fill: rgba(40, 92, 84, 0.04);
  stroke: rgba(40, 92, 84, 0.18);
}
.gen-band-axis {
  stroke: rgba(143, 45, 30, 0.12);
  stroke-width: 1;
  stroke-dasharray: 1 5;
}
.gen-band-tab-bg {
  fill: #fff;
  stroke: rgba(143, 45, 30, 0.32);
  stroke-width: 1.2;
  filter: drop-shadow(0 2px 4px rgba(70,56,42,0.12));
}
.gen-band.alt .gen-band-tab-bg {
  stroke: rgba(40, 92, 84, 0.45);
}
.gen-band-tab-label {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 15px;
  font-weight: 600;
  fill: var(--accent);
}
.gen-band.alt .gen-band-tab-label { fill: #285c54; }
.gen-band-tab-meta {
  font-size: 10px;
  fill: var(--ink-soft);
  letter-spacing: 0.4px;
}
.gen-band-watermark {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 48px;
  fill: rgba(143, 45, 30, 0.09);
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

/* ========= Edges ========= */
.lineage-edge.clean {
  fill: none;
  stroke: rgba(120, 86, 54, 0.55);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms ease, stroke-width 160ms ease;
}
.lineage-edge.clean.active {
  stroke: var(--accent);
  stroke-width: 2.2;
}
/* ========= Clean-mode nodes ========= */
.lineage-node-link {
  cursor: pointer;
  outline: none;
}
.node-card {
  fill: #fffaf0;
  stroke: rgba(143, 45, 30, 0.34);
  stroke-width: 1.2;
  filter: url(#nodeShadow);
  transition: fill 160ms ease, stroke 160ms ease, stroke-width 160ms ease, transform 160ms ease;
}
.node-glyph {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 17px;
  fill: var(--ink);
  font-weight: 500;
}
.node-glyph.compact { font-size: 12px; }
.node-spouse-bg {
  fill: #fff5e6;
  stroke: rgba(143, 45, 30, 0.28);
  stroke-width: 0.9;
  stroke-dasharray: 2 2;
}
.node-spouse-cap {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 9px;
  fill: rgba(143, 45, 30, 0.72);
  letter-spacing: 0.5px;
}
.node-spouse-glyph {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 11px;
  fill: var(--ink-soft);
  font-weight: 500;
}
.lineage-node-link:hover .node-spouse-bg,
.lineage-node-link.is-selected .node-spouse-bg {
  fill: #ffead0;
  stroke: rgba(143, 45, 30, 0.55);
}
.lineage-node-link:hover .node-card {
  fill: #fff5e0;
  stroke: var(--accent);
  stroke-width: 1.8;
}
.lineage-node-link.is-match .node-card {
  fill: #e7f5ee;
  stroke: #2e7d6e;
  stroke-width: 1.6;
}
.lineage-node-link.is-match .node-glyph { fill: #1c4f47; }
.lineage-node-link.is-selected .node-card {
  fill: #fff1d6;
  stroke: var(--accent);
  stroke-width: 2.4;
}
.lineage-node-link.is-selected .node-glyph { fill: var(--accent); font-weight: 600; }
.lineage-node-link.node-listed_child .node-card { fill: rgba(255, 252, 247, 0.7); }
.lineage-node-link.node-listed_child .node-glyph { font-size: 14px; }

.lineage-svg-link { color: inherit; }
.lineage-svg-node {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2px 0.12px;
  border-radius: 0.45px;
  border: 0.12px solid rgba(143, 45, 30, 0.32);
  background: rgba(255, 250, 241, 0.92);
  color: var(--ink);
  font-size: 1.25px;
  line-height: 1.05;
  text-align: center;
  writing-mode: vertical-rl;
  box-shadow: 0 0.28px 0.65px rgba(62, 42, 26, 0.08);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.lineage-svg-link:hover .lineage-svg-node,
.lineage-svg-link.is-selected .lineage-svg-node {
  transform: scale(1.08);
  border-color: rgba(143, 45, 30, 0.75);
  background: rgba(255, 242, 222, 0.96);
}
.lineage-svg-link.is-match .lineage-svg-node {
  border-color: rgba(40, 92, 84, 0.78);
  background: rgba(232, 248, 241, 0.92);
  color: #285c54;
}
.lineage-svg-link.node-listed_child .lineage-svg-node {
  font-size: 1.1px;
  background: rgba(255, 252, 247, 0.66);
}

.lineage-actions {
  margin-top: 12px;
}

.lineage-result-list {
  max-height: 380px;
  overflow: auto;
}

.chain-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.chain-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.9);
}

.chain-item span {
  color: var(--ink-soft);
  font-size: 12px;
}

.chain-item strong {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 18px;
}

.chain-item.current {
  border-color: rgba(143, 45, 30, 0.45);
  background: rgba(143, 45, 30, 0.08);
}

.compact-chain {
  max-height: 420px;
  overflow: auto;
}

.link-arrow {
  color: var(--accent);
}

.empty-state {
  text-align: center;
}

.rise {
  opacity: 0;
  transform: translateY(22px);
  animation: rise-in 520ms ease forwards;
}

.delay-1 {
  animation-delay: 100ms;
}

.delay-2 {
  animation-delay: 180ms;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .stat-grid,
  .grid.two-col,
  .grid.two-col.wide-left,
  .lineage-layout {
    grid-template-columns: 1fr;
  }

  .lineage-command,
  .lineage-workbench-grid {
    grid-template-columns: 1fr;
  }

  .lineage-command-actions {
    justify-content: flex-start;
  }

  .lineage-filter-panel,
  .lineage-side-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .lineage-map-panel {
    order: 1;
  }

  .lineage-filter-panel {
    order: 2;
  }

  .lineage-side-panel {
    order: 3;
  }

  .hero-inner {
    padding: 20px;
  }

  .hero h1 {
    font-size: clamp(34px, 6.2vw, 52px);
  }

  .lineage-side-panel {
    position: static;
  }

  .hero-main,
  .section-head,
  .record-head,
  .detail-hero,
  .form-head {
    flex-direction: column;
  }

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

  .account-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 680px) {
  .auth-header {
    padding: 14px 10px 4px;
  }

  .auth-header-inner {
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .auth-header .site-brand {
    min-height: 42px;
    padding: 4px;
    border-color: transparent;
    background: transparent;
  }

  .auth-header .brand-seal {
    width: 38px;
    height: 38px;
  }

  .auth-brand-copy {
    display: none;
  }

  .auth-page-actions {
    gap: 5px;
  }

  .auth-page-actions .account-link {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
  }

  .auth-page .shell {
    width: 100%;
    padding: 22px 12px 40px;
  }

  .hero {
    padding: 18px 12px 6px;
  }

  .hero-inner,
  .shell {
    width: min(var(--page-width), calc(100vw - 20px));
  }

  .hero-inner,
  .panel,
  .record-card {
    border-radius: 14px;
  }

  .hero-inner {
    padding: 18px;
  }

  .site-brand {
    min-height: 48px;
  }

  .top-nav {
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }

  .top-nav a {
    min-width: 0;
    min-height: 46px;
    padding: 11px 10px;
    font-size: 14px;
  }

  .account-link,
  .account-chip {
    flex: 1 1 auto;
  }

  .panel,
  .record-card,
  .source-card,
  .mini-card {
    padding: 16px;
  }

  .search-form input {
    min-width: 100%;
  }

  .search-form button {
    width: 100%;
    min-height: 50px;
  }

  .home-workbench,
  .home-feature-lineage,
  .home-compact-section {
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(38, 30, 22, 0.07);
  }

  .home-workbench {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .home-brief h2 {
    font-size: 30px;
  }

  .home-brief .muted {
    font-size: 14px;
    line-height: 1.55;
  }

  .home-search > div {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .home-search input {
    min-height: 56px;
    padding: 0 16px;
  }

  .home-search button {
    min-height: 52px;
    border-top: 1px solid rgba(143, 45, 30, 0.12);
  }

  .home-quick-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .home-quick-grid a {
    min-height: 68px;
    padding: 12px;
  }

  .home-quick-grid strong {
    font-size: 16px;
  }

  .home-feature-lineage {
    display: grid;
    gap: 14px;
    padding: 16px;
  }

  .home-feature-lineage h3,
  .home-compact-section h3 {
    font-size: 22px;
  }

  .home-feature-lineage .button-link {
    width: 100%;
  }

  .home-compact-section {
    padding: 16px;
  }

  .home-menu-note {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .lineage-command {
    padding: 14px;
    border-radius: 14px;
  }

  .lineage-command-search {
    grid-template-columns: 1fr;
  }

  .lineage-command-search button {
    min-height: 56px;
    border-left: 0;
    border-top: 1px solid rgba(143, 45, 30, 0.12);
  }

  .lineage-command-search input {
    min-height: 58px;
    padding: 0 18px;
    font-size: 16px;
  }

  .lineage-map-panel,
  .lineage-tool-section {
    padding: 10px;
    border-radius: 14px;
  }

  .lineage-toolbar {
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .lineage-canvas {
    height: min(78svh, 760px);
    border-radius: 12px;
  }

  .lineage-canvas .lineage-clean-svg {
    width: 1280px;
  }

  .lineage-minimap {
    width: 92px;
    height: min(210px, calc(100% - 24px));
    right: 8px;
    bottom: 8px;
    opacity: 0.9;
  }

  .lineage-generation-strip {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .node-glyph {
    font-size: 15px;
  }
}

@media (max-width: 760px) {
  body.mobile-menu-open {
    overflow: hidden;
  }

  .hero {
    position: sticky;
    top: 0;
    z-index: 80;
    padding: 0;
    background: rgba(251, 252, 250, 0.94);
    border-bottom: 1px solid rgba(29, 47, 43, 0.1);
    backdrop-filter: blur(12px);
  }

  .hero-inner,
  .shell {
    width: 100%;
  }

  .hero-inner {
    display: block;
    padding: 8px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .hero .site-brand {
    min-height: 44px;
    max-width: calc(100vw - 74px);
    padding: 5px 8px 5px 5px;
    border-radius: 14px;
    border-color: transparent;
    background: transparent;
  }

  .hero .brand-seal {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

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

  .hero .eyebrow {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .hero-main,
  .account-actions {
    display: none;
  }

  .mobile-menu-button {
    appearance: none;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border: 1px solid rgba(29, 47, 43, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 12px rgba(20, 32, 30, 0.08);
  }

  .mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
  }

  .mobile-drawer-close {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(29, 47, 43, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font: inherit;
    font-size: 28px;
    line-height: 1;
  }

  .mobile-nav-drawer {
    display: flex;
    flex-direction: column;
  }

  body.mobile-menu-open .mobile-nav-drawer {
    transform: translateX(0);
  }

  .shell {
    padding: 12px 12px 44px;
  }

  .panel,
  .record-card,
  .source-card,
  .mini-card {
    border-radius: 14px;
  }

  .section-head,
  .record-head,
  .detail-hero,
  .form-head {
    gap: 12px;
  }
}
/* ===== Person Card Modal ===== */
body.pcard-open { overflow: hidden; }

.pcard-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  animation: pcard-fade-in 200ms ease;
}
.pcard-modal[hidden] { display: none; }

.pcard-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 28, 18, 0.55);
  backdrop-filter: blur(4px);
}

.pcard-modal-shell {
  position: relative;
  width: min(820px, 100%);
  max-height: calc(100vh - 64px);
  background: linear-gradient(180deg, #fffaf0 0%, #faf3e3 100%);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(40, 28, 18, 0.4), 0 0 0 1px rgba(143, 45, 30, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pcard-rise 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pcard-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pcard-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pcard-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.08);
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  z-index: 2;
  transition: background 140ms ease, transform 140ms ease;
}
.pcard-modal-close:hover { background: rgba(143, 45, 30, 0.18); transform: rotate(90deg); }

.pcard-modal-stack {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 60px 0 22px;
  font-size: 12px;
  color: var(--ink-soft);
  min-height: 0;
}
.pcard-modal-stack:empty { padding: 0; }
.pcard-crumb {
  appearance: none;
  border: 0;
  background: rgba(70, 56, 42, 0.08);
  color: var(--ink-soft);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pcard-crumb.current { background: rgba(143, 45, 30, 0.16); color: var(--accent); cursor: default; }
.pcard-crumb-sep { color: rgba(70, 56, 42, 0.4); }

.pcard-modal-body {
  overflow: auto;
  padding: 22px 72px 28px 26px;
  flex: 1;
}

.pcard-loading {
  text-align: center;
  padding: 60px 0;
  color: var(--ink-soft);
}

.pcard {
  display: grid;
  gap: 16px;
}

.pcard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-right: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(143, 45, 30, 0.12);
}
.pcard-head h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 26px;
  margin: 4px 0 6px;
  color: var(--accent);
}
.pcard-head-actions { flex-shrink: 0; }

.alias-block.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.alias-pill small {
  margin-left: 6px;
  font-size: 10px;
  opacity: 0.7;
}

.pcard-hero {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 252, 247, 0.8);
  border: 1px solid rgba(143, 45, 30, 0.12);
}
.pcard-hero img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.pcard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pcard-rel {
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid rgba(143, 45, 30, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
}
.pcard-rel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.pcard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.pcard-list li {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 15px;
}
.pcard-list a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(143, 45, 30, 0.4);
  transition: color 120ms ease, border-color 120ms ease;
}
.pcard-list a:hover { color: #5a1a0f; border-color: var(--accent); }

.pcard-section h4 {
  margin: 4px 0 8px;
  color: var(--accent);
  font-size: 14px;
}

.pcard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pcard-intro {
  border: 1px solid rgba(143, 45, 30, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 252, 247, 0.78);
}
.pcard-bio-list { display: grid; gap: 10px; }
.pcard-bio { display: grid; gap: 6px; }

.pcard-entries { display: grid; gap: 10px; }
.pcard-entry {
  border: 1px solid rgba(143, 45, 30, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 252, 247, 0.7);
}
.pcard-entry-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-soft);
  align-items: center;
}
.pcard-entry-snippet img {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}
.pcard-entry-text {
  margin-top: 8px;
  max-height: 170px;
  overflow: auto;
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 250, 240, 0.76);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}
.pcard-intro-text {
  margin-top: 0;
  max-height: 240px;
  background: rgba(255, 250, 240, 0.9);
}
.muted.small { font-size: 12px; margin: 4px 0 0; }
.button-link.block { display: block; text-align: center; }

@media (max-width: 640px) {
  .pcard-grid { grid-template-columns: 1fr; }
  .pcard-modal-shell { max-height: calc(100vh - 32px); border-radius: 16px; }
  .pcard-head { flex-direction: column; }
}

@media (max-width: 900px) {
  .list-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .list-head-row {
    display: none;
  }
}

/* node has-card cursor hint */
.lineage-node-link.has-card { cursor: pointer; }
.lineage-node-link.has-card .node-card { stroke-dasharray: none; }

/* ===== Grave feature cards on homepage ===== */
.accent-grave { background: linear-gradient(135deg, #f5f0e8, #e8ddd0); }
.accent-grave strong { color: #5c3a21; }

.grave-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.grave-feature-card {
  display: block;
  background: #faf7f2;
  border: 1px solid #e8ddd0;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.grave-feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(92,58,33,0.10);
}
.grave-feature-card .grave-thumb {
  height: 90px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid #e8ddd0;
}
.grave-feature-card strong {
  display: block;
  font-size: 13px;
  color: #3e2716;
  padding: 8px 10px 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grave-feature-card span {
  display: block;
  font-size: 11px;
  color: #7a6a5a;
  padding: 0 10px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Grave Modal ===== */
.gmodal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmodal[hidden] { display: none; }
.gmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30,20,10,0.55);
  backdrop-filter: blur(4px);
}
.gmodal-shell {
  position: relative;
  background: #faf7f2;
  border: 1px solid #d8c8b0;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(30,20,10,0.25);
  max-width: 900px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gmodal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #5c3a21;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmodal-close:hover { background: #fff; }
.gmodal-img-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: #1a1410;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gmodal-img-wrap img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}
.gmodal-body {
  padding: 18px 22px 22px;
  background: #faf7f2;
  flex-shrink: 0;
}
.gmodal-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #3e2716;
}
.gmodal-body .gmodal-loc {
  margin: 0 0 6px;
  font-size: 14px;
  color: #6b5b4f;
}
.gmodal-body .gmodal-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: #7a6a5a;
  line-height: 1.5;
}
.gmodal-body .gmeta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #a09080;
}

@media (max-width: 680px) {
  .grave-showcase { grid-template-columns: repeat(2, 1fr); }
  .gmodal-shell { max-height: calc(100vh - 20px); border-radius: 12px; }
  .gmodal-img-wrap img { max-height: 40vh; }
  .gmodal-body { padding: 14px 16px 18px; }
  .gmodal-body h3 { font-size: 16px; }
}

/* User registration, questionnaires, and admin */
.narrow-panel {
  width: min(760px, 100%);
  margin: 0 auto;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  color: var(--ink);
}

.alert.success {
  background: rgba(46, 125, 110, 0.1);
  border-color: rgba(46, 125, 110, 0.28);
  color: #235f55;
}

.alert.error {
  background: rgba(143, 45, 30, 0.08);
  border-color: rgba(143, 45, 30, 0.26);
  color: var(--accent);
}

.code-panel {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(31, 116, 107, 0.08);
  overflow-x: auto;
}

.code-panel code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.form-stack {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.form-grid {
  margin-top: 0;
}

.grid.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
  color: var(--ink);
}

.form-field > span,
.question-block legend {
  font-weight: 650;
}

.form-field input,
.form-field select,
.form-field textarea,
.question-block input[type="text"],
.question-block input[type="date"],
.question-block select,
.question-block textarea,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
}

.form-field textarea,
.question-block textarea,
.admin-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-field em,
.form-error {
  color: var(--accent);
  font-style: normal;
  font-size: 13px;
}

.has-error input,
.has-error select,
.has-error textarea,
.question-block.has-error {
  border-color: rgba(143, 45, 30, 0.5);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.choice-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  line-height: 1.35;
}

.choice-card input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.inline-choice {
  width: fit-content;
}

.primary-action {
  width: fit-content;
  border-color: rgba(31, 116, 107, 0.48);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.2);
}

.primary-action:hover {
  color: #fff;
}

.action-row,
.row-actions,
.compact-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-actions .button-link,
.row-actions .button-link {
  margin-top: 0;
}

.survey-grid {
  align-items: stretch;
}

.survey-card {
  display: grid;
  gap: 10px;
}

.survey-card .link-arrow {
  color: var(--accent);
  font-weight: 650;
}

.survey-form-panel {
  width: min(920px, 100%);
  margin: 0 auto;
}

.question-form {
  gap: 20px;
}

.question-block {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.question-block legend {
  padding: 0 8px;
}

.question-help {
  margin: 4px 0 14px;
  color: var(--ink-soft);
}

.required-mark {
  color: var(--accent);
  margin-left: 4px;
}

.profile-stats .stat-card strong {
  font-size: 22px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.admin-list-table .list-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 120px;
}

.admin-questionnaire-table .list-row {
  grid-template-columns: 100px minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1fr) 180px;
}

.admin-response-table .list-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 90px 120px;
}

.admin-response-table em {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-style: normal;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.status-pill.published {
  background: rgba(46, 125, 110, 0.12);
  border-color: rgba(46, 125, 110, 0.28);
  color: #235f55;
}

.status-pill.draft {
  background: rgba(80, 120, 160, 0.1);
  border-color: rgba(80, 120, 160, 0.25);
  color: #3f6e90;
}

.status-pill.archived {
  background: rgba(70, 56, 42, 0.08);
  color: var(--ink-soft);
}

.admin-form {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.admin-inline-check {
  align-self: end;
  margin-top: 0;
}

.admin-question-stack,
.answer-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-question-card,
.answer-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.admin-question-card.inactive {
  opacity: 0.62;
}

.compact-head {
  align-items: center;
}

.danger-form {
  margin-top: 12px;
}

.answer-card h3 {
  margin: 6px 0 8px;
  font-size: 18px;
}

.answer-card p:last-child {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.admin-summary-panel,
.response-summary-panel {
  margin-top: 18px;
}

.summary-note-grid,
.questionnaire-summary-grid,
.tag-summary-grid,
.user-summary-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.summary-note-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-note {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(31, 116, 107, 0.08);
  color: var(--teal);
  line-height: 1.6;
}

.questionnaire-summary-grid,
.user-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.summary-card,
.user-summary-card,
.followup-card,
.summary-block {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

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

.summary-card strong,
.user-summary-card strong,
.followup-card strong {
  font-size: 18px;
}

.summary-card em,
.summary-card small,
.user-summary-card span,
.user-summary-card em,
.followup-card span {
  color: var(--ink-soft);
  font-style: normal;
}

.admin-summary-grid {
  align-items: start;
}

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

.tag-summary-group {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tag-summary-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.tag-summary-group h4,
.summary-block h4 {
  margin: 0 0 10px;
  font-size: 17px;
}

.compact-chip-list {
  margin-top: 10px;
  gap: 8px;
}

.followup-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.user-summary-card .compact-head {
  gap: 10px;
}

.user-summary-card .compact-head > div {
  display: grid;
  gap: 4px;
}

.response-insight-grid {
  margin-top: 18px;
  align-items: start;
}

.answer-rollup + .answer-rollup,
.text-answer-quote + .text-answer-quote {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-rollup strong {
  display: block;
  line-height: 1.5;
}

.text-answer-quote {
  margin: 0;
  padding: 0;
}

.text-answer-quote p {
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.text-answer-quote footer {
  color: var(--ink-soft);
  font-size: 13px;
}

@media (max-width: 960px) {
  .grid.three-col,
  .admin-list-table .list-row,
  .admin-questionnaire-table .list-row,
  .admin-response-table .list-row {
    grid-template-columns: 1fr;
  }

  .admin-questionnaire-table .list-head-row,
  .admin-response-table .list-head-row,
  .admin-list-table .list-head-row {
    display: none;
  }
}

@media (max-width: 680px) {
  .choice-grid,
  .choice-grid.compact {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .action-row .button-link {
    width: 100%;
  }

  .inline-choice {
    width: 100%;
  }
}

/* ===== Public acquisition portal ===== */
.portal-home {
  --portal-paper: #fbf7ef;
  --portal-ink: #17231f;
  --portal-red: #9f3028;
  --portal-red-deep: #7f211c;
  --portal-green: #205f55;
  --portal-gold: #ba8a3d;
  background:
    radial-gradient(circle at 84% 8%, rgba(186, 138, 61, 0.12), transparent 24%),
    linear-gradient(180deg, #fdfcf8 0%, #f6f2e9 62%, #edf1eb 100%);
  overflow-x: hidden;
}

.portal-home::before { opacity: 0.58; }

.app-download-link {
  border-color: rgba(155, 51, 40, 0.28);
  color: var(--accent);
  background: rgba(155, 51, 40, 0.07);
}

.app-download-link:hover,
.app-download-link:focus-visible {
  border-color: rgba(155, 51, 40, 0.5);
  color: #fff;
  background: var(--accent);
}

.portal-home .shell { padding-top: 18px; }
.portal-home .hero-inner { box-shadow: 0 12px 34px rgba(23, 38, 34, 0.07); }
.portal-home .hero-main { display: none; }

.portal-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  min-height: 610px;
  padding: clamp(44px, 7vw, 86px) clamp(28px, 5vw, 66px);
  overflow: hidden;
  border: 1px solid rgba(51, 67, 59, 0.12);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(253, 252, 247, 0.99) 0%, rgba(253, 252, 247, 0.94) 47%, rgba(253, 252, 247, 0.7) 66%, rgba(253, 252, 247, 0.46) 100%),
    url("/static/images/hero-v2.jpg") center / cover no-repeat;
  box-shadow: 0 30px 80px rgba(43, 49, 39, 0.1);
}

.portal-hero::after {
  content: "彭";
  position: absolute;
  right: -26px;
  bottom: -96px;
  color: rgba(159, 48, 40, 0.035);
  font-family: "Songti SC", "STSong", serif;
  font-size: 390px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.portal-hero-copy,
.portal-ai-card { position: relative; z-index: 1; }

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding: 8px 12px;
  border: 1px solid rgba(32, 95, 85, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--portal-green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.portal-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34a46f;
  box-shadow: 0 0 0 4px rgba(52, 164, 111, 0.12);
}

.portal-hero h2 {
  margin: 0;
  color: var(--portal-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", serif;
  font-size: clamp(48px, 5.4vw, 72px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.08;
}

.portal-lead {
  max-width: 640px;
  margin: 22px 0 0;
  color: #56635d;
  font-size: 17px;
  line-height: 1.85;
}

.portal-search {
  display: grid;
  gap: 9px;
  max-width: 660px;
  margin-top: 30px;
}

.portal-search > label {
  color: var(--portal-red);
  font-size: 13px;
  font-weight: 750;
}

.portal-search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 64px;
  padding: 5px 5px 5px 16px;
  overflow: hidden;
  border: 1px solid rgba(32, 95, 85, 0.25);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 34px rgba(32, 95, 85, 0.1), 0 0 0 5px rgba(32, 95, 85, 0.04);
}

.portal-search-field > span {
  color: var(--portal-green);
  font-size: 30px;
  line-height: 1;
  transform: rotate(-18deg);
}

.portal-search-field input {
  min-width: 0;
  min-height: 52px;
  border: 0;
  padding: 0 14px;
  background: transparent;
  color: var(--portal-ink);
  font: inherit;
  font-size: 16px;
  outline: 0;
}

.portal-search-field button {
  min-height: 52px;
  border: 0;
  border-radius: 13px;
  padding: 0 22px;
  background: var(--portal-red);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease;
}

.portal-search-field button:hover,
.portal-search-field button:focus-visible {
  transform: translateY(-1px);
  background: var(--portal-red-deep);
}

.portal-search > p { margin: 0 0 0 2px; color: #7a837f; font-size: 12px; }

.portal-hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 25px;
}

.portal-primary-button,
.portal-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 13px;
  font-weight: 750;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.portal-primary-button {
  padding: 12px 19px;
  background: var(--portal-green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(32, 95, 85, 0.2);
}

.portal-primary-button:hover,
.portal-primary-button:focus-visible {
  transform: translateY(-2px);
  background: #174b43;
  box-shadow: 0 14px 30px rgba(32, 95, 85, 0.26);
}

.portal-text-button { gap: 8px; color: var(--portal-red); }
.portal-text-button:hover,
.portal-text-button:focus-visible { color: var(--portal-red-deep); transform: translateX(2px); }

.portal-ai-card {
  padding: 20px;
  border: 1px solid rgba(37, 61, 53, 0.15);
  border-radius: 25px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 28px 70px rgba(40, 48, 40, 0.18), inset 0 1px rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  transform: rotate(1deg);
}

.portal-ai-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(37, 61, 53, 0.1);
}

.portal-ai-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #f5eee2;
}

.portal-ai-avatar img { width: 43px; height: 43px; object-fit: contain; }
.portal-ai-head strong,
.portal-ai-head span { display: block; }
.portal-ai-head strong { color: var(--portal-ink); font-size: 17px; }
.portal-ai-head span { margin-top: 4px; color: #68736e; font-size: 12px; }

.portal-ai-head i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #34a46f;
}

.portal-ai-head em {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(159, 48, 40, 0.08);
  color: var(--portal-red);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.portal-ai-dialogue { min-height: 154px; padding: 25px 4px 18px; }

.portal-ai-message {
  position: relative;
  margin: 0 30px 0 0;
  padding: 16px 17px;
  border-radius: 6px 17px 17px 17px;
  background: #edf4ef;
  color: #2d3b36;
  font-size: 14px;
  line-height: 1.75;
}

.portal-ai-message.is-changing { animation: portal-answer-in 240ms ease both; }
@keyframes portal-answer-in {
  from { opacity: 0.3; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.portal-ai-prompts { display: grid; gap: 8px; }

.portal-ai-prompts button {
  min-height: 42px;
  border: 1px solid rgba(32, 95, 85, 0.15);
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #42504b;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.portal-ai-prompts button:hover,
.portal-ai-prompts button:focus-visible,
.portal-ai-prompts button[aria-pressed="true"] {
  border-color: rgba(32, 95, 85, 0.38);
  background: rgba(32, 95, 85, 0.08);
  color: var(--portal-green);
}

.portal-ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid rgba(37, 61, 53, 0.1);
}

.portal-ai-footer > span { color: #74807a; font-size: 11px; line-height: 1.45; }
.portal-ai-footer b { color: var(--portal-red); font-size: 18px; }
.portal-ai-footer a { flex: 0 0 auto; color: var(--portal-red); font-size: 13px; font-weight: 750; }

.portal-proof {
  display: grid;
  grid-template-columns: repeat(4, 1fr) minmax(220px, 1.4fr);
  align-items: center;
  margin-top: 16px;
  padding: 18px 24px;
  border: 1px solid rgba(51, 67, 59, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.portal-proof > div {
  padding: 4px 18px;
  border-left: 1px solid rgba(51, 67, 59, 0.1);
}
.portal-proof > div:first-child { padding-left: 0; border-left: 0; }
.portal-proof span,
.portal-proof strong { display: block; }
.portal-proof span { color: #6a756f; font-size: 12px; }
.portal-proof strong {
  margin-top: 3px;
  color: var(--portal-green);
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 27px;
  letter-spacing: 0.02em;
}

.portal-proof > p {
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid rgba(51, 67, 59, 0.1);
  color: #76807c;
  font-size: 12px;
  line-height: 1.65;
}

.portal-section { margin-top: 76px; }
.portal-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.portal-section-head h3,
.portal-feature h3,
.portal-app-copy h3 {
  margin: 7px 0 0;
  color: var(--portal-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(30px, 3.8vw, 44px);
  line-height: 1.18;
}

.portal-section-head > p {
  max-width: 500px;
  margin: 0;
  color: #66716c;
  font-size: 14px;
  line-height: 1.75;
  text-align: right;
}

.portal-path-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.portal-path-card {
  position: relative;
  display: grid;
  min-height: 230px;
  padding: 21px;
  overflow: hidden;
  border: 1px solid rgba(51, 67, 59, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 30px rgba(37, 49, 43, 0.05);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.portal-path-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(32, 95, 85, 0.045);
}

.portal-path-card:hover,
.portal-path-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(32, 95, 85, 0.32);
  box-shadow: 0 18px 36px rgba(37, 49, 43, 0.11);
}

.portal-path-number { color: var(--portal-gold); font-family: "Iowan Old Style", serif; font-size: 14px; font-weight: 700; }
.portal-path-card strong { align-self: end; margin-top: 30px; color: var(--portal-ink); font-size: 21px; }
.portal-path-card p { align-self: start; margin: 9px 0 20px; color: #68736e; font-size: 14px; line-height: 1.65; }
.portal-path-card em { align-self: end; color: var(--portal-red); font-size: 13px; font-style: normal; font-weight: 750; }

.portal-feature {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
  min-height: 430px;
  margin-top: 76px;
  overflow: hidden;
  border: 1px solid rgba(51, 67, 59, 0.12);
  border-radius: 25px;
  background: #f9f5eb;
  box-shadow: 0 24px 60px rgba(43, 49, 39, 0.09);
}

.portal-feature-art {
  min-height: 430px;
  background:
    linear-gradient(90deg, rgba(249, 245, 235, 0.05), rgba(249, 245, 235, 0.18)),
    url("/static/images/hero-v2-mobile.jpg") center 62% / cover no-repeat;
}

.portal-feature-copy { align-self: center; padding: clamp(32px, 5vw, 68px); }
.portal-feature-copy > p:not(.section-kicker) { max-width: 620px; margin: 18px 0 0; color: #63706a; line-height: 1.85; }
.portal-feature-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 23px 0; }
.portal-feature-meta span {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(32, 95, 85, 0.08);
  color: var(--portal-green);
  font-size: 12px;
  font-weight: 700;
}

.portal-app-section {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  margin-top: 76px;
  padding: clamp(30px, 4vw, 48px);
  overflow: hidden;
  border-radius: 25px;
  background:
    radial-gradient(circle at 100% 0%, rgba(186, 138, 61, 0.18), transparent 32%),
    linear-gradient(135deg, #153e37 0%, #205f55 62%, #2f7064 100%);
  color: #fff;
  box-shadow: 0 24px 60px rgba(20, 62, 55, 0.2);
}

.portal-app-section::after {
  content: "彭";
  position: absolute;
  right: 20%;
  bottom: -110px;
  color: rgba(255, 255, 255, 0.035);
  font-family: "Songti SC", serif;
  font-size: 330px;
  line-height: 1;
}

.portal-app-mark,
.portal-app-copy,
.portal-app-actions { position: relative; z-index: 1; }
.portal-app-mark {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 29px;
  background: rgba(255, 255, 255, 0.1);
}

.portal-app-mark img { width: 94px; height: 94px; object-fit: contain; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.18)); }
.portal-app-copy .section-kicker { color: #e2c58e; }
.portal-app-copy h3 { color: #fff; font-size: clamp(29px, 3.4vw, 42px); }
.portal-app-copy > p:not(.section-kicker) { max-width: 700px; margin: 14px 0 0; color: rgba(255, 255, 255, 0.76); line-height: 1.75; }
.portal-app-copy ul { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 19px 0 0; padding: 0; color: rgba(255, 255, 255, 0.86); font-size: 13px; list-style: none; }
.portal-app-copy li::before { content: "✓"; margin-right: 6px; color: #e2c58e; font-weight: 800; }
.portal-app-actions { min-width: 220px; }

.portal-app-download {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 17px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  background: #fff;
  color: var(--portal-green);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16);
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.portal-app-download:hover,
.portal-app-download:focus-visible { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22); }
.portal-app-download > span:first-child { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(32, 95, 85, 0.09); font-size: 23px; }
.portal-app-download small,
.portal-app-download strong { display: block; }
.portal-app-download small { color: #71807a; font-size: 10px; }
.portal-app-download strong { margin-top: 3px; font-size: 15px; }
.portal-app-actions > p { margin: 10px 0 0; color: rgba(255, 255, 255, 0.6); font-size: 11px; text-align: center; }

.portal-news-head { align-items: center; }
.portal-news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.portal-news-grid > a,
.portal-news-empty {
  display: grid;
  min-height: 190px;
  padding: 21px;
  border: 1px solid rgba(51, 67, 59, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 180ms ease, border-color 180ms ease;
}
.portal-news-grid > a:hover,
.portal-news-grid > a:focus-visible { transform: translateY(-3px); border-color: rgba(159, 48, 40, 0.3); }
.portal-news-grid span { width: fit-content; color: var(--portal-red); font-size: 11px; font-weight: 750; }
.portal-news-grid strong { align-self: end; margin-top: 26px; color: var(--portal-ink); font-size: 19px; line-height: 1.45; }
.portal-news-grid p { margin: 8px 0 15px; color: #6b7671; font-size: 13px; line-height: 1.6; }
.portal-news-grid em { align-self: end; color: var(--portal-green); font-size: 12px; font-style: normal; font-weight: 750; }

.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 72px;
  padding: 26px 2px 4px;
  border-top: 1px solid rgba(51, 67, 59, 0.12);
  color: #717c77;
}
.portal-footer > div { display: flex; align-items: center; gap: 10px; }
.portal-footer img { object-fit: contain; }
.portal-footer strong,
.portal-footer small { display: block; }
.portal-footer strong { color: var(--portal-ink); font-size: 14px; }
.portal-footer small,
.portal-footer p { margin: 2px 0 0; font-size: 11px; }
.portal-footer a { color: var(--portal-green); font-weight: 700; }
.portal-mobile-app-cta { display: none; }

.site-record-footer {
  padding: 24px 20px 30px;
  color: #7b8580;
  font-size: 11px;
  text-align: center;
}
.site-record-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.site-record-footer a:hover,
.site-record-footer a:focus-visible { color: var(--portal-red, #9b3028); }

@media (max-width: 1040px) {
  .portal-hero { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr); gap: 30px; padding: 52px 36px; }
  .portal-hero h2 { font-size: clamp(44px, 6vw, 62px); }
  .portal-proof { grid-template-columns: repeat(4, 1fr); }
  .portal-proof > p { grid-column: 1 / -1; margin-top: 14px; padding: 13px 0 0; border-top: 1px solid rgba(51, 67, 59, 0.1); border-left: 0; text-align: center; }
  .portal-path-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-app-section { grid-template-columns: auto 1fr; }
  .portal-app-actions { grid-column: 2; width: fit-content; }
}

@media (max-width: 760px) {
  .portal-home { padding-bottom: 74px; }
  .portal-home .shell { padding-top: 10px; }
  .portal-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 26px;
    padding: 34px 17px 20px;
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(253, 252, 247, 0.97) 0%, rgba(253, 252, 247, 0.91) 54%, rgba(253, 252, 247, 0.74) 100%),
      url("/static/images/hero-v2-mobile.jpg") center / cover no-repeat;
    box-shadow: 0 16px 38px rgba(43, 49, 39, 0.09);
  }
  .portal-hero::after { display: none; }
  .portal-badge { margin-bottom: 13px; }
  .portal-hero h2 { font-size: clamp(40px, 12.3vw, 56px); letter-spacing: -0.06em; }
  .portal-lead { margin-top: 16px; font-size: 15px; line-height: 1.72; }
  .portal-search { margin-top: 23px; }
  .portal-search-field { grid-template-columns: auto minmax(0, 1fr); min-height: 58px; padding: 4px 10px 4px 13px; }
  .portal-search-field button { grid-column: 1 / -1; width: calc(100% + 23px); min-height: 50px; margin: 4px -10px -4px -13px; border-radius: 0 0 13px 13px; }
  .portal-hero-actions { align-items: stretch; flex-direction: column; gap: 10px; margin-top: 20px; }
  .portal-text-button { min-height: 44px; }
  .portal-ai-card { padding: 15px; border-radius: 19px; transform: none; }
  .portal-ai-dialogue { min-height: 142px; padding-top: 18px; }
  .portal-ai-message { margin-right: 10px; }
  .portal-ai-footer { align-items: flex-start; flex-direction: column; }
  .portal-proof { grid-template-columns: repeat(2, 1fr); gap: 0; padding: 12px; border-radius: 15px; }
  .portal-proof > div,
  .portal-proof > div:first-child { padding: 11px 12px; border: 0; }
  .portal-proof > div:nth-child(even) { border-left: 1px solid rgba(51, 67, 59, 0.1); }
  .portal-proof > div:nth-child(n + 3) { border-top: 1px solid rgba(51, 67, 59, 0.1); }
  .portal-proof strong { font-size: 24px; }
  .portal-proof > p { margin: 4px 5px 0; text-align: left; }
  .portal-section,
  .portal-feature,
  .portal-app-section { margin-top: 52px; }
  .portal-section-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  .portal-section-head > p { font-size: 13px; text-align: left; }
  .portal-section-head h3,
  .portal-feature h3,
  .portal-app-copy h3 { font-size: 30px; }
  .portal-path-grid,
  .portal-news-grid { grid-template-columns: 1fr; gap: 9px; }
  .portal-path-card { min-height: 174px; padding: 17px; }
  .portal-path-card strong { margin-top: 20px; }
  .portal-path-card p { margin-bottom: 13px; }
  .portal-feature { grid-template-columns: 1fr; min-height: 0; border-radius: 18px; }
  .portal-feature-art { min-height: 230px; background-position: center 62%; }
  .portal-feature-copy { padding: 25px 19px 28px; }
  .portal-feature-copy .portal-primary-button { width: 100%; }
  .portal-app-section { grid-template-columns: 1fr; gap: 20px; padding: 25px 19px; border-radius: 18px; }
  .portal-app-mark { width: 82px; height: 82px; border-radius: 22px; }
  .portal-app-mark img { width: 69px; height: 69px; }
  .portal-app-copy ul { display: grid; gap: 8px; }
  .portal-app-actions { grid-column: auto; width: 100%; }
  .portal-app-download { justify-content: center; width: 100%; }
  .portal-news-grid > a { min-height: 166px; }
  .portal-news-head .portal-text-button { justify-content: flex-start; }
  .portal-footer { align-items: flex-start; flex-direction: column; margin-top: 48px; padding-bottom: 12px; }
  .portal-mobile-app-cta {
    position: fixed;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 9px 12px 9px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 17px;
    background: rgba(23, 62, 55, 0.96);
    color: #fff;
    box-shadow: 0 16px 36px rgba(20, 41, 35, 0.3);
    backdrop-filter: blur(14px);
  }
  .portal-mobile-app-cta span { color: rgba(255, 255, 255, 0.7); font-size: 11px; }
  .portal-mobile-app-cta strong { padding: 9px 11px; border-radius: 11px; background: #fff; color: var(--portal-green); font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-ai-message.is-changing { animation: none; }
}
