/* FeedAI 配方客户端共用壳层（蛋鸡 index / 猪 pig 对齐） */
:root {
  --bg: #f4f0e6;
  --bg-deep: #e8e2d4;
  --surface: #fffdf8;
  --surface-2: #f9f6ef;
  --primary: #2d5a3d;
  --primary-light: #3d7a52;
  --primary-soft: #d4e8db;
  --accent: #c47a2c;
  --accent-soft: #f5e6d0;
  --text: #1a2e22;
  --muted: #5c6b60;
  --danger: #c0392b;
  --success: #2d7a46;
  --warn: #b8860b;
  --border: #d9d2c4;
  --shadow: 0 20px 60px rgba(26, 46, 34, 0.09);
  --radius: 18px;
  --teal: #0891b2;
  --ink: var(--text);
  font-family: "DM Sans", "Segoe UI", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45, 90, 61, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(196, 122, 44, 0.1), transparent),
    linear-gradient(180deg, var(--bg) 0%, #faf8f3 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(68px + env(safe-area-inset-top)) 16px 24px;
  width: 100%;
  flex: 1;
}
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3500;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.top-nav .nav-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(45, 90, 61, 0.06);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}
.top-nav .nav-pill img { width: 26px; height: 26px; border-radius: 7px; }
.top-nav .nav-brand { color: var(--primary); }
.top-nav .nav-sep { color: #cbd5e1; font-weight: 400; }
.top-nav .nav-tag { font-size: 0.85em; font-weight: 600; color: var(--teal); letter-spacing: 0.04em; }
header.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(45, 90, 61, 0.15);
}
header h1 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 1.85rem;
  font-weight: 700;
}
header .subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 640px;
}
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(45, 90, 61, 0.22);
}
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-accent { background: var(--accent); color: #fff; text-decoration: none; display: inline-block; }
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  background: var(--surface-2);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.tab {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.section-title {
  margin: 0 0 14px;
  font-family: "Noto Serif SC", serif;
  font-size: 1.12rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.section-title .count {
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 999px;
}
.section-title-row { justify-content: space-between; flex-wrap: wrap; }
.btn-text-reset {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 4px 0;
}
.btn-text-reset:hover { color: var(--primary); text-decoration: underline; }
.btn-text-reset.hidden { display: none !important; }
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  padding: 28px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(217, 210, 196, 0.85);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(12px);
  text-align: center;
}
.site-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.85;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.hint {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 14px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 16px;
}
.stat-card strong {
  display: block;
  font-size: 1.55rem;
  margin-bottom: 4px;
  font-family: "Noto Serif SC", serif;
}
.stat-card span { color: var(--muted); font-size: 0.86rem; }
.table-wrap {
  overflow-x: auto;
  margin: 0 -8px;
  padding: 0 8px;
}
.table-wrap--scroll {
  max-height: min(65vh, 720px);
  overflow: auto;
  border: 1px solid rgba(26, 46, 34, 0.08);
  border-radius: 12px;
  background: var(--surface);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; font-size: 0.88rem; }
th, td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(26, 46, 34, 0.07);
  white-space: nowrap;
}
th {
  background: var(--surface-2);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 3;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
tr.selected-row { background: rgba(45, 90, 61, 0.04); }
tr.unselected-row { opacity: 0.55; }
input[type="number"], input[type="text"], select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
input.table-input { width: 72px; padding: 6px 8px; font-size: 0.84rem; }
.cat-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.cat-energy { background: #fef3cd; color: #856404; }
.cat-protein { background: #d4edda; color: #155724; }
.cat-mineral { background: #d1ecf1; color: #0c5460; }
.cat-oil { background: #fff3cd; color: #856404; }
.cat-additive { background: #e2d9f3; color: #4a2c7a; }
.cat-amino { background: #f8d7da; color: #721c24; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.badge.ok { background: #d4edda; color: var(--success); }
.badge.warn { background: #fff3cd; color: var(--warn); }
.badge.neutral { background: #e9ecef; color: var(--muted); }
.hen-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--primary-soft);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.hen-stage-bar label { font-weight: 600; font-size: 0.88rem; color: var(--primary); }
.stage-select {
  flex: 1 1 200px;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
}
.stage-hint { flex: 1 1 100%; margin: 0; font-size: 0.84rem; color: var(--muted); }
.hen-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  max-width: 720px;
}
.hen-param-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-2);
}
.hen-param-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.hen-param-card input.hen-param-input {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 10px 12px;
}
.hen-param-card .param-unit { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.hen-param-notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(180, 120, 20, 0.12);
  color: #8a5a10;
  font-size: 0.84rem;
  line-height: 1.45;
}
.hen-param-notice.hidden { display: none !important; }
.pig-t-param-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 100%;
}
.pig-params-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}
.pig-params-row .hen-stage-bar {
  margin-bottom: 0;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
}
.pig-params-row .hen-stage-bar label {
  margin-bottom: 6px;
}
.pig-params-row .stage-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
.pig-params-row .hen-stage-bar .pig-t-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
@media (max-width: 768px) {
  .pig-params-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hen-params-grid { grid-template-columns: 1fr; }
  .pig-t-param-grid { grid-template-columns: 1fr; }
}
.result-summary-card {
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 120%);
}
.summary-status { padding: 14px 16px; border-radius: 12px; margin-bottom: 14px; line-height: 1.65; }
.summary-status--ok { background: rgba(45, 122, 70, 0.1); border: 1px solid rgba(45, 122, 70, 0.22); }
.summary-status--warn { background: rgba(184, 134, 11, 0.1); border: 1px solid rgba(184, 134, 11, 0.25); }
.summary-status--gentle { background: rgba(90, 120, 160, 0.08); border: 1px solid rgba(90, 120, 160, 0.2); }
.summary-status-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 8px; }
.summary-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.summary-status--ok .summary-badge { background: rgba(45, 122, 70, 0.18); color: var(--success); }
.summary-cost strong { font-family: "Noto Serif SC", serif; font-size: 1.15rem; color: var(--accent); }
.summary-label { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.summary-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.summary-pill { padding: 5px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); color: var(--primary); }
.summary-sub { margin: 0 0 6px; font-size: 0.86rem; color: var(--muted); line-height: 1.55; }
.summary-additive-notes {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.summary-additive-notes .summary-sub strong { color: var(--text); }
.summary-note { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); font-style: italic; }
.summary-cta { margin-top: 4px; padding: 16px 18px; border-radius: 14px; background: var(--primary-soft); border: 1px solid rgba(45, 90, 61, 0.2); }
.summary-cta-text strong { display: block; font-family: "Noto Serif SC", serif; font-size: 1.02rem; margin-bottom: 6px; color: var(--primary); }
.summary-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.summary-cta-actions a { text-decoration: none; text-align: center; padding: 10px 16px; border-radius: 999px; }
.summary-cta-foot { margin: 0; font-size: 0.78rem; color: var(--muted); }
.formula-unlock-card { border-color: #d4e8dc; background: linear-gradient(180deg, #f7fbf8 0%, #fff 100%); }
.user-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.user-chip-wrap { position: relative; }
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: min(300px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 31, 22, 0.12);
  padding: 16px 18px;
}
.account-popover[hidden] { display: none !important; }
.account-popover-user { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.account-popover-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.account-popover-link {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}
.account-popover-link:hover { background: var(--primary-soft); color: var(--primary); }
.account-popover-meta { font-size: 0.84rem; color: var(--muted); }
.account-popover-logout {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding-top: 12px;
}
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(26, 46, 34, 0.55);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.auth-gate.hidden { display: none; }
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.auth-brand-text strong { color: var(--primary); }
.auth-brand-text span { font-size: 0.82rem; font-weight: 600; color: var(--teal); }
.auth-card h2 { margin: 0 0 6px; font-family: "Noto Serif SC", serif; font-size: 1.35rem; }
.auth-desc { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 6px; }
.auth-field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.auth-row { display: flex; gap: 10px; }
.auth-row input { flex: 1; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 14px; font-size: 0.84rem; }
.auth-links-sep { color: var(--border); user-select: none; }
.auth-seg { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-seg button { flex: 1; margin: 0; }
.auth-seg button.active { border-color: var(--accent); color: var(--accent); }
.auth-links button { border: none; background: none; color: var(--primary); cursor: pointer; font: inherit; }
.auth-subview { display: none; }
.auth-subview.active { display: block; }
.auth-back { border: none; background: none; color: var(--muted); cursor: pointer; margin-bottom: 12px; font: inherit; }
.auth-agreement { display: flex; gap: 8px; font-size: 0.8rem; margin-top: 12px; color: var(--muted); }
.auth-msg { min-height: 1.2em; margin-top: 10px; font-size: 0.84rem; }
.auth-msg.error { color: var(--danger); }
.auth-msg.hint { color: var(--muted); }
.auth-footer-nav { display: flex; justify-content: center; gap: 8px; margin-top: 12px; font-size: 0.84rem; }
.auth-home-link { border: none; background: none; color: var(--muted); cursor: pointer; font: inherit; }
.auth-icp { margin: 12px 0 0; text-align: center; font-size: 0.78rem; }
.auth-icp a { color: var(--muted); text-decoration: none; }
.hidden { display: none !important; }

/* 仔猪定制企业服务 */
.enterprise-service-card {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(45, 90, 61, 0.22);
  background: linear-gradient(180deg, #f3faf6 0%, #fff 100%);
}
.enterprise-service-card--compact { padding: 14px 16px; }
.enterprise-service-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.enterprise-service-title {
  margin: 0 0 6px;
  font-family: "Noto Serif SC", serif;
  font-size: 1.08rem;
  color: var(--primary);
  line-height: 1.35;
}
.enterprise-service-sub { margin: 0 0 12px; font-size: 0.88rem; color: var(--muted); }
.enterprise-service-bullets {
  margin: 0 0 12px;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.55;
}
.enterprise-service-bullets li { margin-bottom: 4px; }
.enterprise-service-price {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
}
.enterprise-service-price strong {
  font-family: "Noto Serif SC", serif;
  font-size: 1.35rem;
  color: var(--accent);
}
.enterprise-service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.enterprise-service-actions .enterprise-cta,
.enterprise-service-actions .enterprise-cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}
.enterprise-service-contacts {
  margin: 0 0 8px;
  font-size: 0.8rem;
  line-height: 1.6;
}
.enterprise-service-contacts a,
.enterprise-contact-link { color: var(--primary); text-decoration: none; }
.enterprise-service-contacts a:hover,
.enterprise-contact-link:hover { text-decoration: underline; }
.enterprise-service-disclaimer {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}
.enterprise-service-foot { margin: 10px 0 0; font-size: 0.84rem; }
.enterprise-service-foot a { color: var(--primary); font-weight: 600; }

@media (max-width: 720px) {
  header.hero { grid-template-columns: 1fr; }
  .hero-actions { align-items: stretch; }
  header h1 { font-size: 1.45rem; }
}
