/**
 * 文件用途：
 * 三里豚配种管理阶段 1 H5 的移动端视觉与布局。
 * 以米白、暖橙和低饱和绿色为主，强调大字号、清晰分区与大点击区域。
 */
:root {
  --bg: #ece7de;
  --paper: #f7f3ec;
  --surface: #fffdf9;
  --surface-soft: #f3ede4;
  --surface-warm: #fff0e6;
  --ink: #302b24;
  --ink-soft: #655d52;
  --muted: #8e8376;
  --line: #e8dfd2;
  --line-strong: #d8ccbc;
  --orange: #ef6a2d;
  --orange-dark: #d85118;
  --orange-soft: #ffdfcb;
  --green: #2c7b58;
  --green-dark: #1f5d43;
  --green-soft: #e4f0e9;
  --amber: #a86c16;
  --amber-soft: #f8ebcf;
  --red: #b33b2d;
  --red-soft: #fae3df;
  --shadow: 0 12px 34px rgba(65, 48, 30, 0.08);
  --shadow-soft: 0 6px 18px rgba(65, 48, 30, 0.06);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --tabbar-height: 72px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 227, 204, 0.8), transparent 30%),
    radial-gradient(circle at 87% 79%, rgba(210, 228, 216, 0.7), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(239, 106, 45, 0.24);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--paper);
  box-shadow: 0 0 50px rgba(57, 43, 28, 0.12);
}

.page {
  min-height: 100vh;
  padding: 18px 16px calc(var(--tabbar-height) + 30px + env(safe-area-inset-bottom));
}

.page.detail-page {
  padding-bottom: calc(91px + env(safe-area-inset-bottom));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section {
  margin-top: 24px;
}

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

.section-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.section-note {
  color: var(--muted);
  font-size: 13px;
}

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

.home-hero {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  padding: 23px 22px 24px;
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), transparent 48%),
    linear-gradient(145deg, #2e503f 0%, #416e55 55%, #69876c 100%);
  color: #fffdf7;
  box-shadow: 0 16px 32px rgba(35, 76, 55, 0.18);
}

.home-hero::before,
.home-hero::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  pointer-events: none;
}

.home-hero::before {
  top: -94px;
  right: -72px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.home-hero::after {
  right: 28px;
  bottom: -92px;
  width: 190px;
  height: 190px;
  background: rgba(255, 214, 170, 0.13);
}

.brand-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-name::before,
.brand-name::after {
  width: 10px;
  height: 1.5px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  content: "";
}

.date-pill {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 35, 24, 0.18);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.hero-title {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 27px 0 10px;
  font-size: 31px;
  line-height: 1.16;
  letter-spacing: -0.045em;
}

.hero-subtitle {
  position: relative;
  z-index: 1;
  max-width: 220px;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  line-height: 1.55;
}

.hero-pig {
  position: absolute;
  right: 19px;
  bottom: 19px;
  z-index: 1;
  width: 92px;
  height: 92px;
  opacity: 0.92;
  transform: rotate(-4deg);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.kpi-card {
  grid-column: span 2;
  min-height: 92px;
  padding: 14px 13px 12px;
  border: 1px solid rgba(224, 214, 201, 0.8);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow-soft);
}

.kpi-card:nth-child(4),
.kpi-card:nth-child(5) {
  grid-column: span 3;
}

.kpi-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 29px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.04em;
}

.kpi-unit {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.quick-card {
  display: flex;
  min-height: 94px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
}

.quick-card.male {
  background: var(--surface-warm);
  color: #7d3b1e;
}

.quick-card.female {
  background: var(--green-soft);
  color: #285f49;
}

.quick-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
}

.quick-sub {
  display: block;
  margin-top: 5px;
  color: currentColor;
  font-size: 12px;
  opacity: 0.72;
}

.quick-plus {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
}

.reminder-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.reminder-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: var(--amber-soft);
  color: var(--amber);
}

.reminder-copy {
  min-width: 0;
  flex: 1;
}

.reminder-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.reminder-text {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 17px;
}

.page-heading {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.top-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: var(--orange);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(239, 106, 45, 0.2);
  cursor: pointer;
}

.archive-tabs {
  margin-bottom: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.segmented-btn {
  min-height: 43px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.segmented-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(64, 48, 30, 0.08);
}

.segmented-btn:disabled {
  color: #aaa094;
  cursor: not-allowed;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  appearance: none;
}

.search-input::placeholder {
  color: #aaa094;
}

.status-scroller {
  display: flex;
  gap: 8px;
  margin: 11px -16px 0;
  padding: 0 16px 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.status-scroller::-webkit-scrollbar {
  display: none;
}

.status-scroller.wrap {
  flex-wrap: wrap;
  margin-right: 0;
  margin-left: 0;
  padding-right: 0;
  padding-left: 0;
  overflow-x: visible;
}

.status-scroller.wrap .filter-chip {
  white-space: nowrap;
}

.filter-chip {
  min-height: 37px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 2px 10px;
  color: var(--muted);
  font-size: 13px;
}

.profile-list {
  display: grid;
  gap: 11px;
}

.profile-card {
  display: flex;
  width: 100%;
  min-height: 104px;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.avatar {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 21px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.88), transparent 33%),
    linear-gradient(145deg, var(--avatar-a), var(--avatar-b));
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar svg {
  width: 78%;
  height: 78%;
}

.profile-main {
  min-width: 0;
  flex: 1;
}

.profile-code {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.profile-name {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 19px;
  font-weight: 850;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.profile-sub span {
  position: relative;
}

.profile-sub span + span::before {
  position: absolute;
  top: 50%;
  left: -5px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.profile-side {
  display: flex;
  align-self: stretch;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

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

.status-badge.culled,
.status-badge.dead {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.profile-weight {
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.chevron {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #aaa094;
}

.empty-card {
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 28px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 249, 0.62);
  text-align: center;
}

.empty-illustration {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 24px;
  background: var(--surface-warm);
  color: var(--orange);
}

.empty-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.empty-text {
  max-width: 250px;
  margin: 7px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.back-btn,
.icon-btn {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.detail-top-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.detail-hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 87% 8%, rgba(255, 255, 255, 0.75), transparent 31%),
    linear-gradient(145deg, #f9e6d8, #f5d8c2);
}

.detail-hero.female {
  background:
    radial-gradient(circle at 87% 8%, rgba(255, 255, 255, 0.8), transparent 31%),
    linear-gradient(145deg, #e1ece4, #cbded2);
}

.detail-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-hero .avatar {
  width: 88px;
  height: 88px;
  border-radius: 27px;
}

.detail-name {
  margin: 4px 0 2px;
  font-size: 27px;
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.detail-code {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.detail-hero.female .detail-code {
  color: var(--green-dark);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.detail-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(91, 62, 40, 0.12);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.stat-cell {
  min-width: 0;
  padding: 15px 10px;
  text-align: center;
}

.stat-cell + .stat-cell {
  border-left: 1px solid var(--line);
}

.stat-value {
  display: block;
  overflow: hidden;
  font-size: 23px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.info-card {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 850;
}

.card-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.info-cell {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.info-cell.full {
  grid-column: 1 / -1;
}

.info-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.info-value {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.48;
}

.info-value.warning {
  color: var(--red);
}

.line-value.warning {
  color: var(--red);
}

.line-list {
  display: grid;
  gap: 0;
}

.line-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.line-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.line-value {
  min-width: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.timeline-empty {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.timeline-dot {
  position: relative;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 6px;
  border: 3px solid var(--orange-soft);
  border-radius: 50%;
  background: var(--orange);
}

.danger-text-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 15px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.action-bar {
  position: fixed;
  z-index: 18;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: 100%;
  max-width: 460px;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 9px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(226, 216, 203, 0.8);
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(16px);
}

.phase-grid {
  display: grid;
  gap: 11px;
}

.phase-action {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.phase-action-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-warm);
  color: var(--orange-dark);
}

.phase-action:nth-child(2) .phase-action-icon {
  background: var(--green-soft);
  color: var(--green-dark);
}

.phase-action:nth-child(3) .phase-action-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.phase-action-copy {
  min-width: 0;
  flex: 1;
}

.phase-action-title {
  display: block;
  font-size: 16px;
  font-weight: 850;
}

.phase-action-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.phase-tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.settings-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:first-child {
  padding-top: 0;
}

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

.settings-label {
  font-size: 14px;
  font-weight: 750;
}

.settings-value {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.progress-list {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

.progress-dot {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.progress-item.done .progress-dot {
  background: var(--green-soft);
  color: var(--green-dark);
}

.tabbar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: 100%;
  max-width: 460px;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(226, 216, 203, 0.82);
  background: rgba(255, 253, 249, 0.95);
  backdrop-filter: blur(18px);
}

.tab-item {
  display: flex;
  min-height: 57px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: #958b80;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.tab-item svg {
  width: 22px;
  height: 22px;
}

.tab-item.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.fab {
  position: fixed;
  z-index: 17;
  right: max(19px, calc((100vw - 460px) / 2 + 19px));
  bottom: calc(var(--tabbar-height) + 18px + env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border: 0;
  border-radius: 17px;
  background: var(--orange);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(239, 106, 45, 0.3);
  cursor: pointer;
}

.sheet-layer,
.modal-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(39, 31, 23, 0.4);
  backdrop-filter: blur(3px);
}

.sheet {
  display: flex;
  width: 100%;
  max-width: 460px;
  max-height: 94vh;
  max-height: 94dvh;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 54px rgba(46, 33, 22, 0.2);
}

.sheet-form {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 236, 0.97);
}

.sheet-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.sheet-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sheet-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}

.sheet-body {
  flex: 1;
  padding: 17px 18px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-footer {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.97);
}

.form-section + .form-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.form-section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 850;
}

.form-section-note {
  margin: -5px 0 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-grid .field {
  margin-bottom: 0;
}

.field-grid + .field-grid {
  margin-top: 12px;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
}

.field-label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.field-control {
  width: 100%;
  min-height: 47px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  appearance: none;
}

.field-control::placeholder {
  color: #b0a699;
}

textarea.field-control {
  min-height: 88px;
  line-height: 1.55;
  resize: vertical;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.choice-chip.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.choice-chip.danger.active {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.photo-item,
.photo-add {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 15px;
}

.photo-item {
  background: var(--surface-soft);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(40, 34, 27, 0.62);
  color: #fff;
  cursor: pointer;
}

.photo-add {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
  box-shadow: 0 8px 18px rgba(239, 106, 45, 0.2);
}

.btn-green {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.btn-danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.btn:disabled {
  border-color: var(--line);
  background: var(--surface-soft);
  color: #aaa094;
  box-shadow: none;
  cursor: not-allowed;
}

.action-bar .btn {
  min-width: 0;
  padding: 0 8px;
  font-size: 13px;
}

.modal-layer {
  z-index: 60;
  align-items: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 390px;
  padding: 22px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(43, 31, 21, 0.24);
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.modal-text {
  margin: 10px 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast-root {
  position: fixed;
  z-index: 80;
  right: 16px;
  bottom: calc(var(--tabbar-height) + 20px + env(safe-area-inset-bottom));
  left: 16px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(42, 36, 29, 0.94);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 34px rgba(35, 28, 22, 0.22);
}

.toast.error {
  background: rgba(153, 48, 38, 0.96);
}

.hidden {
  display: none !important;
}

.quick-card.breeding {
  background: #e7eef8;
  color: #365a82;
}

.quick-card.calf {
  background: var(--amber-soft);
  color: #7a541b;
}

.status-badge.neutral {
  background: #eef0f2;
  color: #6d747a;
}

.mini-toggle {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.mini-toggle.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.timeline-list {
  display: grid;
  gap: 0;
}

.timeline-event {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline-event:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.timeline-event-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 3px solid var(--orange-soft);
  border-radius: 50%;
  background: var(--orange);
}

.timeline-event-dot.sc {
  border-color: var(--green-soft);
  background: var(--green);
}

.timeline-event-dot.zz {
  border-color: var(--amber-soft);
  background: var(--amber);
}

.timeline-event-main {
  min-width: 0;
  flex: 1;
}

.timeline-event-date {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.timeline-event-title {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.4;
}

.timeline-event-sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
}

.phase-tag.active-tag {
  background: var(--green-soft);
  color: var(--green-dark);
}

.record-filter-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.record-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.record-filter-title strong {
  color: var(--ink);
  font-size: 15px;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.filter-field,
.filter-select {
  display: flex;
  min-width: 0;
  min-height: 57px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  text-align: left;
}

.filter-field {
  grid-column: 1 / -1;
}

.filter-field span,
.filter-select span {
  color: var(--muted);
  font-size: 14px;
}

.filter-field input {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.filter-select {
  color: var(--ink);
  cursor: pointer;
}

.filter-select strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-tabs {
  margin-top: 16px;
}

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

.record-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.record-main {
  min-width: 0;
  flex: 1;
}

.record-code {
  display: block;
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.record-title {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.selector-control {
  display: flex;
  width: 100%;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.selector-control.selected {
  border-style: solid;
  color: var(--ink);
  font-weight: 750;
}

.readonly-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 10px;
}

.readonly-box {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 12px;
  background: #eae5dc;
}

.readonly-box span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.readonly-box strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-choice {
  margin-top: -7px;
}

.risk-safe,
.warning-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border-radius: 14px;
}

.risk-safe {
  background: var(--green-soft);
  color: var(--green-dark);
}

.warning-card {
  background: var(--red-soft);
  color: var(--red);
}

.risk-safe svg,
.warning-card svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

.risk-safe div,
.warning-card div {
  display: grid;
  gap: 3px;
}

.risk-safe strong,
.warning-card strong {
  font-size: 15px;
}

.risk-safe span,
.warning-card span {
  font-size: 14px;
  line-height: 1.5;
}

.inbreeding-card {
  margin-bottom: 10px;
}

.ack-row {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.ack-row.checked {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.ack-box {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  font-weight: 900;
}

.ack-row.checked .ack-box {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.soft-warning {
  margin: 10px 0 14px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14px;
  line-height: 1.5;
}

.quantity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 16px;
  padding: 13px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.quantity-row strong {
  display: block;
  font-size: 15px;
}

.stepper {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.stepper button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.stepper button:disabled {
  color: #bbb2a7;
}

.stepper strong {
  min-width: 24px;
  text-align: center;
  font-size: 21px;
}

.calf-batch-list {
  display: grid;
  gap: 13px;
}

.calf-batch-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.calf-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calf-batch-head strong {
  font-size: 16px;
}

.calf-batch-head span {
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 800;
}

.calf-chain {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.chain-step {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 11px 8px;
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}

.chain-step.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.chain-step span {
  color: var(--muted);
  font-size: 14px;
}

.chain-step strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-arrow {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 17px;
}

.linked-record {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.linked-record:last-child {
  border-bottom: 0;
}

.linked-record small {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.linked-record strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.linked-list {
  display: grid;
}

.picker-layer {
  z-index: 70;
  background: rgba(39, 31, 23, 0.5);
}

.picker-sheet {
  max-height: 78vh;
  max-height: 78dvh;
}

.picker-clear {
  width: 100%;
  min-height: 44px;
  margin-bottom: 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.picker-list {
  display: grid;
  gap: 9px;
}

.picker-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.picker-item .avatar {
  width: 50px;
  height: 50px;
  border-radius: 15px;
}

.picker-symbol {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-warm);
  color: var(--orange-dark);
}

.picker-item-main {
  min-width: 0;
  flex: 1;
}

.picker-item-main strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-item-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

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

.secondary-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.nav-pill {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.pedigree-page {
  padding-bottom: 28px;
}

.pedigree-hero {
  padding: 20px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 88% 15%, rgba(255, 255, 255, 0.8), transparent 29%),
    linear-gradient(145deg, #eef4ef, #dce8df);
}

.pedigree-title {
  margin: 4px 0 8px;
  font-size: 29px;
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.pedigree-intro {
  max-width: 320px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.pedigree-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  margin-top: 15px;
  color: var(--green-dark);
  font-size: 14px;
}

.pedigree-stats strong {
  font-size: 18px;
}

.pedigree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.zoom-group button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
}

.zoom-group strong {
  min-width: 52px;
  text-align: center;
  font-size: 14px;
}

.toolbar-text {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.pedigree-scroll {
  width: 100%;
  height: min(58vh, 540px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fbf8f2;
  box-shadow: var(--shadow-soft);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pedigree-svg {
  display: block;
  min-width: 100%;
  min-height: 100%;
}

.parent-edge {
  fill: none;
  stroke-width: 1.8;
  opacity: 0.72;
}

.parent-edge.father {
  stroke: #6f96bb;
}

.parent-edge.mother {
  stroke: #c9869d;
}

.pair-edge {
  fill: none;
  stroke: #d6a143;
  stroke-width: 2;
  stroke-dasharray: 7 6;
  opacity: 0.7;
}

.pair-label rect {
  fill: #fff8e7;
  stroke: #e4c98f;
}

.pair-label text {
  fill: #9a6b18;
  font-size: 14px;
  font-weight: 800;
}

.pedigree-node {
  cursor: pointer;
}

.pedigree-node-card {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.5;
  filter: drop-shadow(0 5px 8px rgba(67, 50, 31, 0.08));
}

.pedigree-node.gg .pedigree-node-card {
  fill: #fff7ef;
  stroke: #e5b48e;
}

.pedigree-node.mm .pedigree-node-card {
  fill: #f2f8f4;
  stroke: #9fc5ae;
}

.pedigree-node.zz .pedigree-node-card {
  fill: #fffaf0;
  stroke: #dfc793;
}

.pedigree-type-dot {
  fill: var(--orange);
}

.pedigree-node.mm .pedigree-type-dot {
  fill: var(--green);
}

.pedigree-node.zz .pedigree-type-dot {
  fill: #c39132;
}

.pedigree-node-code {
  fill: var(--orange-dark);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.pedigree-node.mm .pedigree-node-code {
  fill: var(--green-dark);
}

.pedigree-node.zz .pedigree-node-code {
  fill: #9a6b18;
}

.pedigree-node-title {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 850;
}

.pedigree-node-subtitle {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.converted-badge rect {
  fill: var(--green-soft);
  stroke: #b8d5c4;
}

.converted-badge text {
  fill: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.pedigree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  margin-top: 13px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
}

.pedigree-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
}

.legend-dot.mm {
  background: var(--green);
}

.legend-dot.zz {
  background: #c39132;
}

.legend-line {
  width: 20px;
  height: 0;
  border-top: 2px solid #6f96bb;
}

.legend-line.pair {
  border-top: 2px dashed #d6a143;
}

.pedigree-hint {
  margin: 11px 2px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.pedigree-mode {
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.portrait-pedigree {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.family-cluster,
.unlinked-family {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.family-cluster-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.family-kicker {
  display: block;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.family-cluster-head h2 {
  margin: 3px 0 0;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.family-cluster-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.family-count {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.family-parents {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  align-items: stretch;
  gap: 7px;
}

.family-person {
  display: flex;
  min-width: 0;
  min-height: 148px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 11px 7px 10px;
  border: 1px solid #e3b893;
  border-radius: 18px;
  background: #fff7ef;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.family-person.mm {
  border-color: #a8cbb6;
  background: #f2f8f4;
}

.family-person.missing {
  color: var(--muted);
  cursor: default;
}

.family-person .avatar {
  width: 54px;
  height: 54px;
  margin-bottom: 6px;
  border-radius: 17px;
}

.person-role {
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 800;
}

.family-person.mm .person-role {
  color: var(--green-dark);
}

.family-person strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.person-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-meta {
  display: block;
  max-width: 100%;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-pair-bridge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--amber);
}

.family-pair-bridge::before {
  position: absolute;
  top: 50%;
  right: -7px;
  left: -7px;
  border-top: 2px dashed #d9b265;
  content: "";
}

.family-pair-bridge span,
.family-pair-bridge small {
  position: relative;
  z-index: 1;
  background: var(--surface);
}

.family-pair-bridge span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #e4cb9f;
  border-radius: 50%;
  background: #fff8e8;
}

.family-pair-bridge small {
  padding: 2px 4px;
  color: #9a6b18;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.family-tree-trunk {
  position: relative;
  height: 28px;
  margin: 0 auto;
}

.family-tree-trunk::before {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  border-left: 2px dashed #cdbda9;
  content: "";
}

.family-tree-trunk span {
  position: absolute;
  top: -3px;
  left: calc(50% - 4px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}

.family-offspring {
  display: grid;
  gap: 9px;
  margin-left: 13px;
  padding-left: 15px;
  border-left: 2px dashed #d8cbb8;
}

.offspring-card {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 78px;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid #e3d4b9;
  border-radius: 15px;
  background: #fffaf0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.offspring-branch {
  position: absolute;
  top: 28px;
  left: -17px;
  width: 17px;
  border-top: 2px dashed #d8cbb8;
}

.offspring-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 3px solid #f0dca8;
  border-radius: 50%;
  background: #c39132;
}

.offspring-main {
  min-width: 0;
  flex: 1;
}

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

.offspring-main strong {
  font-size: 15px;
  line-height: 1.4;
}

.offspring-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.converted-link {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.family-waiting {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px;
  border-radius: 14px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14px;
  line-height: 1.5;
}

.unlinked-grid {
  display: grid;
  gap: 9px;
}

.unlinked-person {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.unlinked-person .avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.unlinked-person > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.unlinked-person strong,
.unlinked-person > span > span {
  display: block;
}

.unlinked-person strong {
  font-size: 15px;
}

.unlinked-person > span > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

/* 老人友好：所有可见文字不低于 14px，对应小程序的 28rpx 下限。 */
.eyebrow,
.section-note,
.brand-lockup,
.date-pill,
.kpi-label,
.kpi-unit,
.quick-sub,
.reminder-text,
.profile-code,
.profile-sub,
.status-badge,
.profile-weight,
.list-summary,
.detail-code,
.stat-label,
.card-title small,
.info-label,
.line-label,
.line-value,
.timeline-empty,
.phase-action-sub,
.phase-tag,
.settings-value,
.progress-item,
.progress-dot,
.tab-item,
.field-label,
.field-label small,
.field-help,
.photo-add,
.sheet-subtitle,
.danger-text-btn,
.action-bar .btn,
.modal-text {
  font-size: 14px;
}

@media (max-width: 350px) {
  .page {
    padding-right: 13px;
    padding-left: 13px;
  }

  .hero-title {
    font-size: 27px;
  }

  .hero-pig {
    right: 8px;
    bottom: 13px;
    width: 68px;
    height: 68px;
    opacity: 0.66;
  }

  .hero-subtitle {
    max-width: 176px;
  }

  .date-pill {
    display: none;
  }

  .kpi-card {
    padding-right: 10px;
    padding-left: 10px;
  }

  .profile-card {
    gap: 9px;
    padding: 12px;
  }

  .avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .profile-name {
    font-size: 17px;
  }

  .status-scroller {
    margin-right: -13px;
    margin-left: -13px;
    padding-right: 13px;
    padding-left: 13px;
  }

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

  .field-grid .field {
    margin-bottom: 14px;
  }

  .action-bar .btn {
    font-size: 12px;
  }
}

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