*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-soft: #f7faf8;
  --bg-line: #eeeeea;
  --text: #171714;
  --muted: #62625d;
  --faint: #94948e;
  --border: rgba(0, 0, 0, .12);
  --border-strong: rgba(0, 0, 0, .22);
  --green: #168464;
  --green-soft: #e7f4ef;
  --green-dark: #07513e;
  --red: #b3261e;
  --red-soft: #fae9e7;
  --amber: #9a5b00;
  --amber-soft: #f7edda;
  --radius: 10px;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

button,
input,
textarea {
  font: inherit;
}

html {
  scroll-behavior: smooth;
}

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--green);
  border-radius: 50%;
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--green);
  right: -5px;
  bottom: 1px;
  transform: rotate(42deg);
  border-radius: 999px;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 13px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
}

/* ── Page switching ── */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ── Home layout ── */
.home {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 32px 60px;
}

/* ── Hero ── */
.hero {
  max-width: 720px;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 11px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 700;
  margin-bottom: 14px;
}

h1 {
  max-width: 640px;
  font-size: clamp(28px, 4.5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 760;
  margin-bottom: 14px;
}

.lead {
  max-width: 560px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.primary-link:hover {
  background: var(--green-dark);
}

.hero-actions p {
  max-width: 380px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ── Check Purpose Selector ── */
.check-area {
  border-top: 1px solid var(--border);
  padding-top: 26px;
}

.check-purpose {
  margin-bottom: 20px;
}

.check-purpose-label {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 10px;
  color: var(--text);
}

.check-purpose-options {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
}

.check-purpose-option {
  border: 0;
  background: #fff;
  color: var(--muted);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color .15s, background .15s;
}

.check-purpose-option+.check-purpose-option {
  border-left: 1px solid var(--border-strong);
}

.check-purpose-option.active {
  background: var(--green);
  color: #fff;
}

.check-purpose-option:focus-visible {
  outline: 3px solid rgba(22, 132, 100, .22);
  outline-offset: -2px;
}

/* ── Purpose panels ── */
.purpose-panel {
  display: none;
}

.purpose-panel.active {
  display: block;
}

/* ── Method tabs ── */
.check-method-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.check-method-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 16px 10px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.check-method-tab span {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.check-method-tab:hover,
.check-method-tab:focus-visible {
  color: var(--text);
}

.check-method-tab.active {
  border-bottom-color: var(--green);
  color: var(--text);
}

/* ── Focus states ── */
.check-method-tab:focus-visible,
.primary-link:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.text-btn:focus-visible,
.upload-area:focus-visible,
.text-field:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(22, 132, 100, .22);
  outline-offset: 2px;
}

/* ── Check panel ── */
.check-panel {
  padding: 22px 0 4px;
  margin-bottom: 0;
}

.check-panel-content {
  display: none;
}

.check-panel-content.active {
  display: block;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h3 {
  font-size: 17px;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.panel-head p {
  color: var(--muted);
  font-size: 14px;
}

.panel-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--green-dark);
  font-weight: 650;
  margin-bottom: 6px;
}

/* ── Form fields ── */
.field-row {
  display: flex;
  align-items: end;
  gap: 12px;
}

.text-field {
  flex: 1;
  width: 100%;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  min-height: 48px;
  padding: 12px 14px;
  outline: none;
}

.text-field:focus,
textarea:focus {
  border-color: var(--green);
}

.primary-btn {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  min-height: 48px;
  padding: 12px 20px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn:hover {
  background: var(--green-dark);
}

.secondary-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  min-height: 44px;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-btn:hover {
  background: var(--bg-line);
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
}

.input-group {
  flex: 1;
  min-width: 0;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.input-helper {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.panel-actions {
  margin-top: 12px;
}

.character-count {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

/* ── Upload area ── */
.upload-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 120px;
  padding: 18px 0;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
  cursor: pointer;
}

.upload-area.is-drag-over {
  background: var(--green-soft);
}

.upload-area strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.upload-area span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 650;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 0;
  cursor: pointer;
  font-size: 13px;
}

.text-btn:hover {
  color: var(--red);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Status message ── */
.status-message {
  margin-top: 8px;
  font-size: 14px;
  min-height: 0;
}

.status-message:empty {
  display: none;
}

.status-message.is-error {
  color: var(--red);
}

.status-message.is-success {
  color: var(--green-dark);
}

/* ── Identity search ── */
.identity-search {
  margin-bottom: 16px;
}

.identity-barcode-alt {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-line);
}

.identity-alt-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Identity result ── */
.identity-result {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.identity-result-header {
  margin-bottom: 16px;
}

.identity-result-header .identity-status {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.identity-result-header .identity-status.is-found {
  color: var(--green-dark);
}

.identity-result-header .identity-status.is-partial {
  color: var(--amber);
}

.identity-result-header .identity-status.is-not-found {
  color: var(--red);
}

.identity-result-header .identity-status.is-error {
  color: var(--muted);
}

.identity-result-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.identity-result-body td {
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-line);
}

.identity-result-body td:first-child {
  font-weight: 600;
  color: var(--muted);
  width: 180px;
  vertical-align: top;
}

.identity-result-body td:last-child {
  color: var(--text);
}

.identity-match-status {
  display: inline-block;
  font-size: 13px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 4px;
}

.identity-match-status.match-full {
  background: var(--green-soft);
  color: var(--green-dark);
}

.identity-match-status.match-partial {
  background: var(--amber-soft);
  color: var(--amber);
}

.identity-match-status.match-none {
  background: var(--red-soft);
  color: var(--red);
}

.identity-result-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-line);
}

.identity-result-footer p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.identity-result-footer .primary-btn {
  font-size: 14px;
}

/* ── Process steps ── */
.process-steps {
  display: flex;
  gap: 16px;
  margin: 24px 0 28px;
  padding: 14px 0;
  border-top: 1px solid var(--bg-line);
  border-bottom: 1px solid var(--bg-line);
  color: var(--muted);
  list-style: none;
}

.process-steps li {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  line-height: 1.4;
}

.process-steps span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
}

/* ── Trust section ── */
.trust-section {
  margin-top: 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.trust-section h2 {
  margin-bottom: 12px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.trust-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--bg-line);
  border-bottom: 1px solid var(--bg-line);
}

.trust-list .trust-item {
  padding: 14px 16px 14px 0;
  border-right: 1px solid var(--bg-line);
  background: transparent;
}

.trust-list .trust-item+.trust-item {
  padding-left: 16px;
}

.trust-list .trust-item:last-child {
  border-right: 0;
}

.trust-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.trust-item span {
  font-size: 13px;
  color: var(--muted);
}

/* ── Disclaimer ── */
.disclaimer {
  max-width: 820px;
  margin-top: 20px;
  padding: 12px 0 0;
  border-top: 1px solid var(--bg-line);
}

.disclaimer strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.disclaimer p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.disclaimer p+p {
  margin-top: 4px;
}

/* ── Results page ── */
.results {
  max-width: 880px;
  margin: 0 auto;
  padding: 34px 32px 76px;
}

.back-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 34px;
}

.back-btn:hover {
  color: var(--text);
}

/* ── Loading overlay ── */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}

.loading-text {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ── Result page utility classes (kept for backward compat) ── */
.reason-icon {
  color: var(--text);
  font-weight: bold;
  font-size: 16px;
}

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

.empty-note {
  color: var(--muted);
  font-size: 13px;
}

.empty-note--small {
  font-size: 12px;
}

.evidence-item {
  margin-bottom: 20px;
}

.evidence-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.evidence-quote {
  padding: 12px;
  border-left: 3px solid var(--faint);
  border-radius: 2px;
  margin-bottom: 6px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-style: italic;
  font-weight: 600;
}

.evidence-source {
  color: var(--muted);
  font-size: 13px;
}

.evidence-source span {
  color: var(--text);
  font-weight: 600;
}

.evidence-empty {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.reaction-count {
  color: var(--muted);
  font-size: 12px;
}

.empty-list-item {
  color: var(--muted);
  font-style: italic;
  list-style-type: none;
}

.consistency-icon {
  font-weight: bold;
  font-size: 14px;
}

.consistency-icon--check {
  color: var(--green);
}

.consistency-icon--cross {
  color: var(--red);
}

.consistency-text {
  color: var(--muted);
}

.demo-switcher {
  display: none;
}

/* ── u-style utilities (results page — preserved) ── */
.u-style-4 {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  background: #ffffff;
}

.u-style-5 {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.u-style-6 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 30px;
}

.u-style-7 {
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.u-style-8 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.u-style-9 {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: baseline;
}

.u-style-10 {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
}

.u-style-11 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.u-style-12 {
  margin-bottom: 30px;
}

.u-style-13 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.u-style-14 {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.u-style-15 {
  border: 0;
  border-top: 1px solid var(--bg-line);
  margin: 30px 0;
}

.u-style-16 {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.u-style-17 {
  border-bottom: 1px solid var(--bg-line);
}

.u-style-18 {
  padding: 10px 0;
  font-weight: 600;
  color: var(--muted);
  width: 220px;
  vertical-align: top;
}

.u-style-19 {
  padding: 10px 0;
  color: var(--text);
}

.u-style-20 {
  padding: 10px 0;
  font-weight: 600;
  color: var(--muted);
  vertical-align: top;
}

.u-style-21 {
  padding: 10px 0;
  color: var(--text);
  font-weight: 600;
}

.u-style-22 {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.u-style-23 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.u-style-24 {
  color: var(--text);
}

.u-style-25 {
  font-size: 14px;
  line-height: 1.6;
}

.u-style-26 {
  margin: 0 0 10px 0;
  color: var(--text);
}

.u-style-27 {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  color: var(--text);
}

.u-style-28 {
  margin-bottom: 30px;
  padding: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.u-style-29 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.5px;
  margin-top: 0;
  margin-bottom: 12px;
}

.u-style-30 {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 16px 0;
}

.u-style-31 {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.u-style-32 {
  margin-bottom: 40px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  background: #ffffff;
}

.u-style-33 {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.u-style-34 {
  padding-top: 16px;
  cursor: default;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.u-style-35 {
  margin-bottom: 16px;
}

.u-style-36 {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.u-style-37 {
  margin: 0;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 12px;
  border-left: 3px solid var(--faint);
  border-radius: 2px;
}

.u-style-38 {
  font-weight: 600;
}

.u-style-39 {
  background: var(--bg-line);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
  width: 200px;
}

.u-style-40 {
  background: var(--green);
  width: 0%;
  height: 100%;
  transition: width 0.6s ease;
}

.u-style-41 {
  margin-top: 8px;
}

.u-style-42 {
  font-weight: 550;
}

.u-style-43 {
  margin-bottom: 6px;
  color: var(--muted);
}

.u-style-44 {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.u-style-45 {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.u-style-46 {
  margin: 0;
  background: var(--bg-soft);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: pre-wrap;
  font-family: monospace;
  max-height: 150px;
  overflow-y: auto;
}

.u-style-47 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 6px;
  text-align: center;
}

.u-style-48 {
  background: var(--bg-soft);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.u-style-49 {
  font-size: 10px;
  color: var(--muted);
  display: block;
}

.u-style-50 {
  font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  nav {
    padding: 0 22px;
  }

  .nav-links {
    display: none;
  }

  .home,
  .results {
    padding-left: 22px;
    padding-right: 22px;
  }

  .hero {
    max-width: none;
  }

  .process-steps {
    flex-direction: column;
    gap: 8px;
  }

  .check-method-tabs {
    margin-right: -22px;
    padding-right: 22px;
  }

  .check-method-tab {
    min-width: 120px;
  }

  .field-row,
  .upload-area {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-actions {
    justify-content: flex-start;
  }

  .trust-list {
    grid-template-columns: 1fr;
  }

  .trust-list .trust-item,
  .trust-list .trust-item+.trust-item {
    padding: 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--bg-line);
  }

  .trust-list .trust-item:last-child {
    border-bottom: 0;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .ingredients {
    columns: 1;
  }

  .result-grid {
    grid-template-columns: 1fr !important;
  }

  .identity-result-body td:first-child {
    width: auto;
  }

  .check-purpose-options {
    display: flex;
    width: 100%;
  }

  .check-purpose-option {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .home {
    padding-top: 26px;
  }

  h1 {
    font-size: 28px;
  }

  .lead {
    font-size: 15px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-link {
    width: 100%;
  }

  .check-method-tab {
    min-width: 110px;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .u-style-47 {
    grid-template-columns: repeat(2, 1fr);
  }
}