:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-alt: #f0eee6;
  --text: #1c2420;
  --muted: #56635b;
  --border: #dcd8cb;
  --accent: #1d5c42;
  --accent-light: #e6f2ec;
  --warn-bg: #fff6e5;
  --warn-border: #e5b869;
  --warn-text: #7a4b00;
  --danger-bg: #fdecec;
  --danger-border: #e09191;
  --danger-text: #8b1e1e;
  --ok-bg: #e8f5ee;
  --ok-border: #7dc49e;
  --ok-text: #145338;
  --info-bg: #eaf2fb;
  --info-text: #1b4d89;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 34, 27, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, #163d2d 0%, #235942 100%);
  color: #f8faf8;
  padding: 28px 0;
  border-bottom: 4px solid #8ab89d;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b7dcc6;
  margin-bottom: 6px;
  font-weight: 600;
}

.site-title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.25;
}

.site-subtitle {
  margin: 0;
  max-width: 720px;
  color: #deece4;
  font-size: 15px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.24);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-nav {
  background: rgba(255, 255, 255, 0.1);
  color: #e6f2ec;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.btn-nav.active {
  background: #ffffff;
  color: #163d2d;
  border-color: #ffffff;
}

.dli-calc-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
  background: var(--surface-alt);
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.dli-calc-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.dli-calc-box input,
.dli-calc-box select,
.env-wizard select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

.dli-result-box {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 8px;
  padding: 10px 14px;
}

.env-wizard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.env-wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.env-wizard-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 14px;
  align-items: end;
}

@media (max-width: 860px) {
  .env-wizard-controls {
    grid-template-columns: 1fr;
  }
}

.env-wizard-controls label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.env-advice-box {
  background: var(--accent-light);
  color: var(--ok-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.svg-diagram-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
  margin-bottom: 14px;
}

.svg-diagram-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
}

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

.compat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fcfcfa;
}

.sop-list {
  margin: 0;
  padding-left: 20px;
}

.sop-list li {
  margin-bottom: 10px;
}

.btn-back {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-back:hover {
  background: var(--accent-light);
}

/* Controls */
.main-content {
  padding: 24px 20px 48px;
}

.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.search-wrap input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.search-wrap input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.stats-strip {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.plants-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.plants-table th {
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 700;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.plants-table td {
  padding: 14px;
  border-bottom: 1px solid #ece9df;
  vertical-align: top;
}

.plants-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.plants-table tbody tr:hover {
  background: #f3f7f4;
}

.plant-name-link {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}

.plant-name-link:hover {
  text-decoration: underline;
}

.plant-cell-flex {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plant-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.media-frame {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
  margin-bottom: 14px;
}

.media-frame img {
  max-height: 300px;
  object-fit: contain;
  background: #faf9f4;
}

.plant-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.badge-high_value {
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}

.badge-partial_greens_only,
.badge-long_term_rhizome {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.badge-not_recommended {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-source-verified {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge-source-pending {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

/* Detail View */
.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-title {
  margin: 0;
  font-size: 26px;
}

.detail-latin {
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
  margin-top: 4px;
}

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

.spec-box {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 12px 14px;
}

.spec-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.spec-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.myth-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 680px) {
  .myth-box {
    grid-template-columns: 1fr;
  }
}

.myth-card {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  padding: 14px;
}

.truth-card {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 8px;
  padding: 14px;
}

.card-kicker {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.step-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fcfcfa;
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-right: 8px;
}

.step-title {
  font-weight: 700;
  font-size: 16px;
}

.checkpoint-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ok-bg);
  border-left: 4px solid var(--accent);
  font-size: 13.5px;
}

.redflag-box {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  border-left: 4px solid #c93b3b;
  font-size: 13.5px;
}

.cite-pill {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid #b6d0ef;
  cursor: pointer;
}

.cite-pill:hover {
  background: #d3e5fa;
}

.media-placeholder {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 13px;
}

.media-frame img,
.media-frame video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.pitfall-item {
  border-bottom: 1px solid #ece9df;
  padding: 12px 0;
}

.pitfall-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.source-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.source-item.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 92, 66, 0.2);
}

.source-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.source-page {
  font-weight: 700;
  color: var(--accent);
}

/* Modal */
.modal {
  border: none;
  border-radius: var(--radius);
  max-width: 680px;
  width: calc(100% - 32px);
  padding: 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.modal::backdrop {
  background: rgba(15, 25, 20, 0.55);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

.modal-body {
  padding: 18px 20px 22px;
  font-size: 14px;
}

.code-block {
  background: #1d2421;
  color: #e6efe9;
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  white-space: pre-wrap;
}

.modal-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: 8px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  font-size: 13px;
  color: var(--muted);
}
