:root {
  --bg: #f4f6f3;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --text: #263019;
  --muted: #5c6657;
  --line: rgba(52, 144, 65, 0.2);
  --brand: #349041;
  --brand-strong: #247531;
  --brand-soft: #e5f2d7;
  --accent: #64a0c8;
  --accent-soft: #e7f1f8;
  --earth: #5b491f;
  --harvest: #eae4a9;
  --lime: #7ab800;
  --neutral: #cccccc;
  --warn: #8a3f2a;
  --warn-soft: #f5ded5;
  --shadow: 0 18px 44px rgba(38, 48, 25, 0.12);
  --radius-xl: 16px;
  --radius-lg: 10px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 48%, #eef3ed 100%);
}

body.embed {
  min-height: 0;
  background: #ffffff;
}

.page-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

body.embed .page-shell {
  width: 100%;
  margin: 0;
  padding: 16px;
}

.hero {
  padding: 28px 28px 12px;
}

body.embed .hero {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.brand-logo {
  display: block;
  width: min(300px, 72vw);
  height: auto;
  margin-bottom: 22px;
}

.panel-brand-logo {
  display: none;
  width: min(220px, 68vw);
  height: auto;
  margin-bottom: 14px;
}

body.embed .panel-brand-logo {
  display: block;
}

.hero h1,
.panel-head h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.1rem);
  line-height: 1;
  max-width: 12ch;
  color: var(--earth);
}

.hero-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 16px 0 0;
}

.hero-note {
  display: inline-flex;
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
}

body.embed .layout {
  grid-template-columns: 1fr;
}

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

.controls-panel {
  padding: 24px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

body.embed .controls-panel,
body.embed .results-panel {
  max-height: none;
  overflow: visible;
}

.results-panel {
  padding: 24px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.panel-head p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 18px;
}

.species-field {
  display: grid;
  gap: 10px;
  margin: 22px 0 18px;
}

.field {
  display: grid;
  gap: 8px;
  position: relative;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 700;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 600;
}

.inline-toggle input {
  accent-color: var(--brand);
}

select,
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  font: inherit;
  color: var(--text);
  background: var(--surface-strong);
}

.feed-type-dropdown {
  position: relative;
}

.feed-type-control {
  position: relative;
}

.feed-type-control input[type="search"] {
  padding-right: 48px;
}

.feed-type-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
}

.feed-type-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.98);
  padding: 6px;
  display: grid;
  gap: 4px;
  box-shadow: var(--shadow);
}

.feed-type-option {
  appearance: none;
  border: 0;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

.feed-type-option:hover,
.feed-type-option.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.feed-type-empty {
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.92rem;
}

select:focus,
input[type="search"]:focus,
.nutrient-toggle:focus-visible + label,
.ghost-button:focus-visible,
.feed-type-toggle:focus-visible {
  outline: 2px solid rgba(49, 89, 59, 0.45);
  outline-offset: 2px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.selection-summary {
  color: var(--muted);
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.7);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}

.chips-soft .chip {
  background: rgba(49, 89, 59, 0.09);
  color: var(--text);
  font-weight: 600;
}

.chips-warn .chip {
  background: var(--warn-soft);
  color: var(--warn);
}

.category-container {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

.category-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(255, 255, 255, 0.52);
}

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

.category-head h3 {
  margin: 0;
  font-size: 1rem;
}

.category-head span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.nutrient-option {
  position: relative;
}

.nutrient-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nutrient-option label {
  display: block;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  min-height: 100%;
  background: var(--surface-strong);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nutrient-option label:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 89, 59, 0.38);
}

.nutrient-toggle:checked + label {
  border-color: var(--brand);
  background: linear-gradient(180deg, rgba(220, 233, 218, 0.9), rgba(255, 253, 248, 0.94));
}

.nutrient-name {
  display: block;
  font-weight: 700;
  line-height: 1.35;
}

.nutrient-meta {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 6px;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.loading-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  padding: 18px;
}

.results-grid {
  display: grid;
  gap: 16px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.result-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.result-title {
  margin: 0;
  font-size: 1.35rem;
}

.price-pill {
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent-soft);
  color: #7c4318;
  font-weight: 800;
  white-space: nowrap;
}

.result-summary {
  color: var(--muted);
  line-height: 1.6;
  margin: 14px 0 0;
}

.result-block {
  margin-top: 16px;
}

.result-block h4 {
  margin: 0 0 10px;
  font-size: 0.92rem;
}

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

.alternate-list {
  display: grid;
  gap: 12px;
}

.package-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface-strong);
}

.package-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.package-item-name {
  font-weight: 700;
}

.package-item-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.package-subtotal {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

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

.alternate-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.alternate-card-title {
  font-weight: 700;
}

.alternate-card-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.95em;
}

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

  .controls-panel,
  .results-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 1080px) {
  body.embed .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 18px;
  }

  .hero,
  .controls-panel,
  .results-panel {
    padding: 18px;
  }

  .field-grid,
  .nutrient-grid {
    grid-template-columns: 1fr;
  }

  body.embed .page-shell {
    width: 100%;
    padding: 12px;
  }

  body.embed .hero,
  body.embed .controls-panel,
  body.embed .results-panel {
    padding: 0;
  }
}
