:root {
  color-scheme: light;
  --bg: #f7f9f6;
  --panel: #ffffff;
  --ink: #15201c;
  --muted: #64716d;
  --line: #dce5de;
  --teal: #227c72;
  --teal-soft: #e3f4ef;
  --indigo: #4456a6;
  --rose: #b84b63;
  --rose-soft: #fde7ec;
  --amber: #a96f14;
  --amber-soft: #fff1d8;
  --green: #28734f;
  --green-soft: #e4f4e9;
  --shadow: 0 18px 45px rgba(26, 45, 37, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border-radius: 8px;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.header-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 48px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.safety-line {
  max-width: 740px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.header-media {
  position: relative;
  min-height: 230px;
  background: #eaf2ed;
}

.header-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
}

.header-media img {
  width: 100%;
  height: 100%;
  min-height: 230px;
  object-fit: cover;
  object-position: center right;
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(126px, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
  margin: 14px 0;
}

.metric,
.ghost-button {
  min-height: 74px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 16px;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.fit {
  color: var(--green);
}

.verify {
  color: var(--amber);
}

.blocked {
  color: var(--rose);
}

.ghost-button {
  min-width: 118px;
  padding: 0 20px;
  color: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.filters,
.results-area {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(26, 45, 37, 0.06);
}

.filters {
  position: sticky;
  top: 14px;
  padding: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field label,
.field-label,
.sort-box label {
  color: #24332e;
  font-size: 0.88rem;
  font-weight: 800;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(34, 124, 114, 0.20);
  outline-offset: 2px;
  border-color: var(--teal);
}

.chip-list,
.toggle-list {
  display: grid;
  gap: 8px;
  max-height: 238px;
  overflow: auto;
  padding: 2px 2px 2px 0;
}

.chip,
.risk-toggle,
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  padding: 9px 10px;
  cursor: pointer;
}

.chip:hover,
.risk-toggle:hover,
.switch:hover {
  border-color: rgba(34, 124, 114, 0.65);
}

.chip input,
.risk-toggle input,
.switch input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--teal);
  flex: 0 0 auto;
}

.chip span,
.risk-toggle span,
.switch span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.24;
}

.chip small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.switch-row {
  display: grid;
  gap: 8px;
}

.results-area {
  min-height: 680px;
  padding: 18px;
}

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

.results-head h2 {
  margin-bottom: 4px;
  font-size: 1.55rem;
}

#resultSubtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.sort-box {
  display: grid;
  gap: 6px;
  width: min(220px, 100%);
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  border-left: 5px solid var(--amber);
  background: var(--amber-soft);
  padding: 12px 14px;
  color: #4c3510;
  line-height: 1.45;
}

.notice strong {
  white-space: nowrap;
}

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

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 18px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.product-card.blocked-card {
  background: #fff8fa;
  border-color: #f1b7c4;
}

.product-card.verify-card {
  background: #fffdf8;
  border-color: #f1d29b;
}

.product-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.product-title h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.status-fit {
  background: var(--green-soft);
  color: var(--green);
}

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

.status-blocked {
  background: var(--rose-soft);
  color: var(--rose);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.meta {
  min-height: 58px;
  border: 1px solid #edf1ee;
  background: #fbfcfb;
  padding: 8px;
}

.meta b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.meta span {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.tag {
  border: 1px solid #d9e6df;
  background: #f6faf8;
  color: #25433a;
  padding: 5px 8px;
  font-size: 0.79rem;
  line-height: 1.2;
}

.tag.hit {
  border-color: rgba(68, 86, 166, 0.28);
  background: #eef0ff;
  color: var(--indigo);
}

.tag.label-safe {
  border-color: rgba(40, 115, 79, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.tag.label-risk {
  border-color: rgba(184, 75, 99, 0.28);
  background: var(--rose-soft);
  color: var(--rose);
}

.tag.clinical-tag {
  border-color: rgba(68, 86, 166, 0.25);
  background: #f0f2ff;
  color: var(--indigo);
}

.tag.original-tag {
  border-color: #e4e9e6;
  background: #fafbfa;
  color: var(--muted);
}

.warning-text,
.reason-text {
  margin: 10px 0 0;
  color: #4d5a56;
  font-size: 0.9rem;
  line-height: 1.45;
}

.warning-text strong {
  color: var(--rose);
}

.reason-text strong {
  color: var(--amber);
}

.strain-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #263934;
  font-size: 0.92rem;
  line-height: 1.42;
}

.card-side {
  display: grid;
  align-content: start;
  gap: 8px;
}

.score-box {
  display: grid;
  place-items: center;
  min-height: 88px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  text-align: center;
}

.score-box strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
}

.score-box span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.details-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.details-toggle:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.details {
  grid-column: 1 / -1;
  display: none;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.details.open {
  display: block;
}

.label-proof,
.clinical-proof {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  border: 1px solid #d6e7dc;
  background: #f7fbf8;
  padding: 10px;
}

.clinical-proof {
  border-color: #d8ddf2;
  background: #f8f9ff;
}

.label-proof b,
.clinical-proof b {
  color: var(--green);
}

.clinical-proof b {
  color: var(--indigo);
}

.label-proof p,
.clinical-proof p {
  margin: 0;
  color: #41524d;
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.clinical-proof p strong {
  color: var(--indigo);
}

.proof-label {
  align-self: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.proof-meta {
  font-size: 0.82rem !important;
}

.evidence-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.evidence-item {
  border: 1px solid #edf1ee;
  background: #fbfcfb;
  padding: 10px;
}

.evidence-item b {
  display: block;
  margin-bottom: 4px;
}

.evidence-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px dashed #becbc5;
  background: #fbfcfb;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .app-header,
  .workspace {
    grid-template-columns: 1fr;
  }

  .header-media {
    max-height: 210px;
  }

  .filters {
    position: static;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .ghost-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 10px;
  }

  .app-header {
    min-height: 0;
  }

  .header-copy,
  .filters,
  .results-area {
    padding: 14px;
  }

  .toolbar,
  .filter-row,
  .meta-grid,
  .product-card {
    grid-template-columns: 1fr;
  }

  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-box {
    width: 100%;
  }

  .notice {
    flex-direction: column;
    gap: 4px;
  }

  .card-side {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 1.82rem;
  }

  .card-side {
    grid-template-columns: 1fr;
  }
}
