:root {
  --ink: #17211d;
  --muted: #637069;
  --paper: #f7f5ef;
  --card: #fffdf8;
  --line: #dedbd0;
  --green: #165c43;
  --green-soft: #e5f1eb;
  --amber: #94620e;
  --amber-soft: #fff0ca;
  --blue: #315f7d;
  --blue-soft: #e8f1f6;
  --shadow: 0 18px 55px rgba(31, 43, 37, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(211, 231, 219, .8), transparent 29rem),
    var(--paper);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--green); }
.topbar, main, footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; }
.brand small { color: var(--muted); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--green); font-size: 13px; letter-spacing: .05em; }
.text-link { text-decoration: none; font-weight: 650; }
.hero { padding: 76px 0 54px; max-width: 830px; }
.eyebrow, .step { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(39px, 6vw, 68px); line-height: 1.03; letter-spacing: -.035em; font-weight: 500; }
.lead { max-width: 720px; margin: 25px 0 0; color: var(--muted); font-size: 19px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .8fr); gap: 22px; align-items: start; }
.panel, .results { border: 1px solid rgba(222, 219, 208, .9); border-radius: 24px; background: rgba(255, 253, 248, .94); box-shadow: var(--shadow); }
.input-panel { padding: clamp(22px, 4vw, 38px); }
.note-panel { padding: 28px; position: sticky; top: 20px; }
.panel-heading, .results-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
h2 { margin: 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.privacy-chip, .count-chip { padding: 6px 10px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 750; white-space: nowrap; }
.upload-box { margin: 27px 0 0; min-height: 105px; display: flex; align-items: center; gap: 16px; padding: 20px; border: 1.5px dashed #9fac9f; border-radius: 17px; cursor: pointer; background: #fafcf8; transition: .18s ease; }
.upload-box:hover { border-color: var(--green); transform: translateY(-1px); }
.upload-box input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.upload-box small { display: block; color: var(--muted); margin-top: 2px; }
.upload-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: white; background: var(--green); font-size: 25px; }
.status-line { min-height: 24px; margin: 8px 0 0; color: var(--green); font-weight: 650; font-size: 14px; }
.divider { margin: 19px 0; display: flex; align-items: center; gap: 12px; color: #909990; font-size: 13px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
label[for="ingredients"] { display: block; margin-bottom: 7px; font-weight: 750; }
textarea { width: 100%; min-height: 170px; resize: vertical; padding: 16px; border: 1px solid #bcc4bd; border-radius: 15px; color: var(--ink); background: white; font: inherit; outline: none; }
textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 92, 67, .12); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.primary-button { width: 100%; margin-top: 19px; padding: 14px 18px; border: 0; border-radius: 14px; color: white; background: var(--green); font: inherit; font-weight: 760; cursor: pointer; }
.primary-button:hover { background: #104a35; }
.primary-button:disabled { opacity: .65; cursor: wait; }
.note-panel ul { margin: 20px 0 0; padding-left: 21px; color: var(--muted); }
.note-panel li + li { margin-top: 12px; }
.results { margin-top: 28px; padding: clamp(22px, 4vw, 38px); scroll-margin-top: 20px; }
.result-card { margin-top: 19px; padding: 23px; border: 2px solid var(--line); border-radius: 18px; background: white; box-shadow: inset 6px 0 0 transparent; transition: border-color .18s ease, background .18s ease; }
.result-card.result-safe { border-color: #65ae8d; background: #f1faf5; box-shadow: inset 6px 0 0 #23825e; }
.result-card.result-danger { border-color: #d77b6b; background: #fff2ef; box-shadow: inset 6px 0 0 #b83e2f; }
.result-card.result-context { border-color: #dfb459; background: #fff9e9; box-shadow: inset 6px 0 0 #b97a12; }
.result-card.result-unknown { border-color: #a7b9c4; background: #f5f8fa; box-shadow: inset 6px 0 0 #668397; }
.result-card-top { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.recognized { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.result-card h3 { margin: 0; font: 500 24px/1.2 Georgia, serif; }
.result-badge { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 760; text-align: center; }
.badge-caution { color: #8d241b; background: #f7d4cd; }
.badge-context { color: var(--amber); background: var(--amber-soft); }
.badge-unknown { color: var(--blue); background: var(--blue-soft); }
.badge-neutral { color: var(--green); background: var(--green-soft); }
.summary { margin: 18px 0 8px; font-size: 17px; }
.context { margin: 0; color: var(--muted); }
.sources-title { margin: 20px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.source-list { display: grid; gap: 7px; }
.source-link { display: flex; justify-content: space-between; gap: 15px; padding: 11px 13px; border-radius: 11px; background: #f4f7f3; text-decoration: none; }
.source-link span { color: var(--muted); font-size: 13px; text-align: right; }
.unmatched, .empty-state { margin-top: 19px; padding: 18px; border-radius: 14px; background: #f1efe8; color: var(--muted); }
.unmatched p { margin: 6px 0 0; overflow-wrap: anywhere; }
.search-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--ink); }
.search-progress-head span { color: var(--green); font-size: 13px; font-weight: 800; }
.search-progress-track { height: 10px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #d9ddd8; }
.search-progress-bar { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #2a8562, var(--green)); transition: width .45s ease; }
.search-progress-note { font-size: 13px; }
.search-status-group { margin-top: 13px; padding-top: 12px; border-top: 1px solid #dcd9cf; }
.search-status-group strong { color: var(--ink); font-size: 13px; }
.search-status-group p { font-size: 13px; }
.dataset-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
footer { padding: 55px 0 35px; display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
footer p { margin: 0; }
footer nav { display: flex; flex-wrap: wrap; gap: 15px; }
.document { max-width: 780px; margin: 55px auto 90px; padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.document h1 { font-size: clamp(36px, 6vw, 54px); }
.document h2 { margin-top: 30px; font-family: inherit; font-size: 21px; font-weight: 750; }
.document p, .document li { color: #4e5a54; }

@media (max-width: 760px) {
  .hero { padding-top: 44px; }
  .workspace { grid-template-columns: 1fr; }
  .note-panel { position: static; }
  .result-card-top, footer { flex-direction: column; }
  .result-badge { align-self: start; }
  .source-link { flex-direction: column; }
  .source-link span { text-align: left; }
}
