.formula-single {
  --text: #2a221c;
  --muted: #6b5d54;
  --primary: #8b4518;
  --primary-2: #b5651d;
  --line: #e8d9cc;
  --card: #ffffff;
  --soft: #faf5ef;
  --shadow: 0 14px 30px rgba(74, 44, 28, 0.1);

  color: var(--text);
  background: linear-gradient(180deg, #fdfaf7 0%, #f8f4f0 100%);
}

.formula-single * { box-sizing: border-box; }
.formula-single-container { width: min(900px, 92vw); margin: 0 auto; }

.formula-single-hero {
  padding: 48px 0 32px;
  background:
    radial-gradient(circle at top right, rgba(181, 101, 29, 0.12), transparent 40%),
    linear-gradient(135deg, #f5ebe3 0%, #ead9cc 100%);
  border-bottom: 1px solid rgba(139, 69, 24, 0.08);
}

.formula-single-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 320px);
  gap: 28px;
  align-items: start;
}

.formula-single-hero-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.formula-single-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.formula-single-hero-main h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  color: #4a2c1c;
}

.formula-single-lead {
  margin: 14px 0 0;
  color: #5c4032;
  line-height: 1.8;
  font-size: 1.05rem;
}

.formula-single-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.formula-single-terms a {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid #edd9c8;
  color: #5c3824;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.formula-single-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.formula-single-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
}

.formula-single-btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 18px rgba(139, 69, 24, 0.2);
}

.formula-single-btn-secondary {
  color: var(--primary);
  background: #fffdfb;
  border-color: #dcc4b4;
}

.formula-single-thumb-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.formula-single-thumb {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.formula-single-thumb-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background: var(--card);
  border: 1px dashed #dcc4b4;
  border-radius: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

.formula-single-body { padding: 40px 0 64px; }

.formula-single-prose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
  line-height: 1.85;
  font-size: 1.02rem;
}

.formula-single-prose > *:first-child { margin-top: 0; }
.formula-single-prose > *:last-child { margin-bottom: 0; }

.formula-single-prose h2,
.formula-single-prose h3 {
  color: #4a2c1c;
  margin-top: 1.6em;
}

.formula-single-prose a { color: var(--primary-2); font-weight: 700; }

.zyyao-formula-pyramid-card,
.zyyao-formula-role-table-card {
  margin-top: 18px;
}

.zyyao-formula-role-diagram {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.zyyao-formula-role-diagram--structured {
  padding: 16px;
  border: 2px solid #d9c8b8;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffdfb 0%, #fff7f0 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 10px 24px rgba(73, 44, 28, 0.06);
}

.zyyao-formula-role-image-wrap {
  margin: 14px 0 0;
  overflow: hidden;
  border: 2px solid #d9c8b8;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffdfb 0%, #fff7f0 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 10px 24px rgba(73, 44, 28, 0.06);
}

.zyyao-formula-role-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
}

.zyyao-formula-role-band {
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid #dce7e1;
  background: #fff;
  box-shadow: 0 2px 8px rgba(61, 41, 24, 0.04);
}

.zyyao-formula-role-band-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.zyyao-formula-role-band-head h4 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.zyyao-formula-role-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.98rem;
}

.zyyao-formula-role-band-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.zyyao-formula-role-mini-card {
  border-radius: 14px;
  padding: 14px 14px 12px;
  background: #f8faf7;
  border: 1px solid #dce7e1;
}

.zyyao-formula-role-mini-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.02rem;
  line-height: 1.25;
}

.zyyao-formula-role-mini-card span {
  display: block;
  color: #5f6d65;
  font-size: 0.92rem;
  line-height: 1.55;
}

.zyyao-formula-role-band-君药 {
  background: #fff8f3;
  border-color: #ecd0bf;
}

.zyyao-formula-role-band-君药 .zyyao-formula-role-dot {
  background: #b74634;
}

.zyyao-formula-role-band-君药 .zyyao-formula-role-mini-card {
  background: #fff1e8;
  border-color: #ebcab6;
}

.zyyao-formula-role-band-臣药 {
  background: #f7fcf5;
  border-color: #cfe2c7;
}

.zyyao-formula-role-band-臣药 .zyyao-formula-role-dot {
  background: #6f9250;
}

.zyyao-formula-role-band-臣药 .zyyao-formula-role-mini-card {
  background: #edf7ec;
  border-color: #c7dbbb;
}

.zyyao-formula-role-band-佐药 {
  background: #fffaf3;
  border-color: #ecd9b0;
}

.zyyao-formula-role-band-佐药 .zyyao-formula-role-dot {
  background: #c88a2a;
}

.zyyao-formula-role-band-佐药 .zyyao-formula-role-mini-card {
  background: #fff4e3;
  border-color: #ecd7af;
}

.zyyao-formula-role-band-使药 {
  background: #f6f9ff;
  border-color: #cedaf0;
}

.zyyao-formula-role-band-使药 .zyyao-formula-role-dot {
  background: #4e79b8;
}

.zyyao-formula-role-band-使药 .zyyao-formula-role-mini-card {
  background: #edf3ff;
  border-color: #cddaf1;
}

.zyyao-formula-role-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  position: relative;
}

.zyyao-formula-role-table-wrap::before,
.zyyao-formula-role-table-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #c7d8cf;
  pointer-events: none;
}

.zyyao-formula-role-table-wrap::before {
  top: 0;
}

.zyyao-formula-role-table-wrap::after {
  bottom: 0;
}

.zyyao-formula-role-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  background: #fff;
  border: none !important;
  outline: none;
  box-shadow: none;
}

.zyyao-formula-role-table th,
.zyyao-formula-role-table td {
  padding: 14px 16px;
  text-align: left;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 1px solid #e7efe9;
  vertical-align: top;
}

.zyyao-formula-role-table thead {
  border-bottom: 2px solid #c7d8cf;
}

.zyyao-formula-role-table thead th {
  background: #f1f7f3;
  color: #1f6b52;
  font-weight: 700;
  border-bottom: none !important;
}

.zyyao-formula-role-table tbody tr:nth-child(even) td {
  background: #fbfdfb;
}

.zyyao-formula-role-table tbody tr:last-child td {
  border-bottom: none;
}

.zyyao-formula-role-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.zyyao-formula-role-list li {
  border: 1px solid #dce7e1;
  border-radius: 12px;
  background: #f8faf7;
  padding: 10px 12px;
}

.zyyao-formula-role-list li strong {
  display: block;
  margin-bottom: 4px;
  color: #1f6b52;
}

@media (max-width: 900px) {
  .formula-single-hero-grid { grid-template-columns: 1fr; }
  .zyyao-formula-role-band-items { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .zyyao-formula-role-table {
    min-width: 480px;
  }
}

/* Formula detail hero: single-column compact header. */
.herb-detail-hero--formula .herb-detail-hero-grid {
  grid-template-columns: 1fr;
}
.herb-detail-hero--formula .herb-detail-hero-main {
  padding: 30px;
}
.herb-detail-breadcrumbs {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.6;
}
.herb-detail-breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
}
.herb-detail-breadcrumbs a:hover,
.herb-detail-breadcrumbs a:focus-visible {
  color: #164734;
  text-decoration: underline;
}
.herb-detail-name-lines--formula {
  padding-top: 12px;
  border-top: 1px solid rgba(31, 107, 82, 0.14);
}
.herb-detail-name-lines--formula span {
  gap: 8px;
}
.herb-detail-name-lines--formula strong {
  color: #173f31;
  font-weight: 900;
}
.herb-detail-taxonomy-lines {
  margin-top: 8px;
}
.herb-detail-formula-overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.herb-detail-formula-overview-grid .herb-detail-overview-card {
  min-height: 112px;
}
.herb-detail-formula-overview-grid .herb-detail-overview-card span a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.herb-detail-formula-overview-grid .herb-detail-overview-card span a:hover,
.herb-detail-formula-overview-grid .herb-detail-overview-card span a:focus-visible {
  text-decoration: underline;
}
.herb-detail-overview-card--safety {
  border-color: #f0d28e;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e6 100%);
}
.herb-detail-overview-card--safety strong {
  color: #9b5a08;
}
.herb-detail-btn-warning {
  color: #9b5a08 !important;
  border: 1px solid #f0d28e;
  background: linear-gradient(180deg, #fff8e6 0%, #fff1cc 100%);
}
.herb-detail-btn-warning:hover,
.herb-detail-btn-warning:focus-visible {
  color: #7e4705 !important;
  background: linear-gradient(180deg, #fff4d8 0%, #ffe9bb 100%);
}

@media (max-width: 900px) {
  .herb-detail-formula-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .herb-detail-hero--formula .herb-detail-hero-main {
    padding: 20px;
  }
  .herb-detail-formula-overview-grid {
    grid-template-columns: 1fr;
  }
}
