:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3ee;
  color: #17221b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at 15% 10%, rgba(130, 188, 123, 0.22), transparent 26rem),
    linear-gradient(135deg, #f7faf6 0%, #e6eee6 45%, #f8f3eb 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px);
  gap: 32px;
  align-items: start;
  justify-content: center;
  min-height: 100vh;
  padding: 32px;
}

.phone-frame {
  width: min(100%, 430px);
  min-height: 780px;
  background: #fbfdf9;
  border: 1px solid rgba(23, 34, 27, 0.12);
  border-radius: 32px;
  box-shadow: 0 28px 80px rgba(36, 54, 42, 0.22);
  padding: 20px;
  overflow: hidden;
}

.topbar,
.basket-summary,
.preferences header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.05;
}

.brand-lockup p {
  margin: 4px 0 0;
  color: #637166;
  font-size: 0.76rem;
  font-weight: 750;
}

.membership-button {
  min-height: 36px;
  border: 1px solid #d39b2a;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff8e8;
  color: #76500a;
  font-size: 0.76rem;
  font-weight: 900;
}

.membership-button.is-premium {
  border-color: #4b975c;
  background: #eaf5e9;
  color: #2d713c;
}

.eyebrow {
  margin: 0 0 4px;
  color: #637166;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(23, 34, 27, 0.12);
  border-radius: 50%;
  background: #ffffff;
  color: #17221b;
  font-size: 1.2rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 22px 0;
  padding: 4px;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 12px;
  background: #eef4ed;
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #536159;
  font-weight: 800;
}

.tab.active {
  background: #ffffff;
  color: #17221b;
  box-shadow: 0 4px 14px rgba(33, 49, 38, 0.1);
}

.scan-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #536159;
  font-weight: 800;
}

.scan-action img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-heading {
  margin: 4px 2px 14px;
}

.product-search,
.ingredient-form,
.result-panel,
.basket-summary,
.history-summary,
.metric,
.insight-strip,
.notes-panel,
.preferences form {
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 16px;
  background: #ffffff;
}

.membership-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 10px;
  background: #f1f6ef;
}

.membership-strip strong,
.membership-strip span {
  display: block;
}

.membership-strip span {
  margin-top: 3px;
  color: #647168;
  font-size: 0.76rem;
}

.membership-strip button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: #17221b;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 900;
}

.membership-strip button.is-premium {
  background: #347e48;
}

.product-search {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px;
}

.product-search > label {
  font-size: 0.86rem;
  font-weight: 900;
}

.product-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.product-search-controls input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid rgba(23, 34, 27, 0.16);
  border-radius: 10px;
  padding: 0 12px;
  background: #fbfdf9;
  color: #17221b;
}

.product-search-controls button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: #17221b;
  color: #ffffff;
  font-weight: 900;
}

.product-search-results {
  display: grid;
}

.product-search-result {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-top: 1px solid rgba(23, 34, 27, 0.09);
  padding: 8px 0;
  background: transparent;
  color: #17221b;
  text-align: left;
}

.product-search-result:hover,
.product-search-result:focus-visible {
  background: #f1f6ef;
  outline: 2px solid rgba(80, 145, 88, 0.45);
  outline-offset: 2px;
}

.product-search-result img,
.search-result-placeholder {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  background: #edf3ec;
  object-fit: contain;
}

.search-result-placeholder {
  display: grid;
  place-items: center;
  color: #1f7a4c;
  font-size: 0.7rem;
  font-weight: 950;
}

.search-result-copy,
.search-result-copy strong,
.search-result-copy > span {
  display: block;
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-copy > span {
  margin-top: 3px;
  color: #6d786f;
  font-size: 0.74rem;
}

.search-result-copy > .search-result-availability {
  font-size: 0.68rem;
  font-weight: 850;
}

.search-result-copy > .search-result-availability.available {
  color: #287444;
}

.search-result-copy > .search-result-availability.unavailable {
  color: #a43b32;
}

.barcode-form {
  display: grid;
  gap: 8px;
}

.barcode-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 16px;
  background: #ffffff;
}

.barcode-form label {
  font-size: 0.86rem;
  font-weight: 900;
}

.barcode-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.barcode-form input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid rgba(23, 34, 27, 0.16);
  border-radius: 10px;
  padding: 0 12px;
  background: #fbfdf9;
  color: #17221b;
}

.barcode-form button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: #17221b;
  color: #ffffff;
  font-weight: 900;
}

.form-status {
  min-height: 18px;
  margin: 0;
  color: #667269;
  font-size: 0.82rem;
}

.form-status.error {
  color: #a72f27;
}

.tabs.is-loading .scan-action img {
  animation: scan-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes scan-pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.primary-button,
.secondary-button,
.ingredient-form button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  font-weight: 900;
}

.primary-button,
.ingredient-form button {
  background: #1f7a4c;
  color: #ffffff;
}

.secondary-button {
  border: 1px solid rgba(23, 34, 27, 0.12);
  background: #f3f6f1;
  color: #17221b;
  font-size: 1.2rem;
}

.ingredient-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
}

.ingredient-form label {
  font-weight: 900;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(23, 34, 27, 0.14);
  border-radius: 10px;
  padding: 12px;
  background: #fbfdf9;
  color: #17221b;
}

.result-panel {
  scroll-margin-top: 16px;
  margin-top: 14px;
  padding: 16px;
}

.secondary-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.empty-state {
  color: #667269;
  margin-bottom: 0;
}

.product-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
}

.product-image {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 10px;
  background: #ffffff;
}

.product-placeholder {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 10px;
  background: #e7f2e8;
  color: #1f7a4c;
  font-weight: 950;
}

.barcode-label {
  margin: 6px 0 0;
  color: #758078;
  font-size: 0.76rem;
}

.source-note {
  margin: 18px 0 0;
  color: #738078;
  font-size: 0.75rem;
}

.score-summary {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border-radius: 10px;
  background: #f4f7f2;
}

.score-summary .score-ring {
  width: 72px;
  height: 72px;
}

.score-summary .score-ring span {
  width: 56px;
  height: 56px;
  font-size: 1.18rem;
}

.score-summary > div:nth-child(2) > strong,
.score-summary > div:nth-child(2) > span {
  display: block;
}

.score-summary > div:nth-child(2) > span {
  margin-top: 4px;
  color: #667269;
  font-size: 0.84rem;
  line-height: 1.35;
}

.score-badges {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 7px;
}

.score-badges span,
.section-count,
.risk-pill,
.tag-list span {
  border-radius: 999px;
  padding: 5px 8px;
  background: #e9eeea;
  color: #4c5a50;
  font-size: 0.72rem;
  font-weight: 850;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(var(--score-color) calc(var(--score) * 1%), #e6ebe4 0);
}

.score-ring span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  font-size: 1.45rem;
  font-weight: 950;
}

.result-panel h3 {
  margin: 0 0 5px;
  font-size: 1.15rem;
}

.result-panel h4 {
  margin: 0;
  font-size: 1rem;
}

.verdict {
  margin-bottom: 0;
  color: #637166;
  font-weight: 800;
}

.chip-row,
.alternative-list,
.basket-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.detail-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(23, 34, 27, 0.1);
}

.detail-disclosure > summary {
  cursor: pointer;
  list-style: none;
}

.detail-disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.disclosure-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef3ed;
  color: #536159;
  font-size: 1.1rem;
  font-weight: 800;
  transition: transform 160ms ease;
}

.detail-disclosure[open] .disclosure-icon {
  transform: rotate(45deg);
}

.disclosure-content {
  padding-top: 2px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.factor-list,
.additive-list,
.assessment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.factor-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 7px;
  align-items: start;
  padding: 10px 0;
}

.factor-row + .factor-row {
  border-top: 1px solid rgba(23, 34, 27, 0.08);
}

.factor-row strong,
.factor-row span {
  display: block;
}

.factor-row > div > span {
  margin-top: 3px;
  color: #657169;
  font-size: 0.86rem;
  line-height: 1.4;
}

.factor-arrow {
  color: #d17f0a;
  font-weight: 950;
}

.factor-row.low .factor-arrow {
  color: #3f964e;
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.nutrition-grid > div {
  padding: 10px;
  border-radius: 8px;
  background: #f4f7f2;
}

.nutrition-grid span,
.nutrition-grid strong {
  display: block;
}

.nutrition-grid span {
  color: #667269;
  font-size: 0.75rem;
}

.nutrition-grid strong {
  margin-top: 3px;
}

.ingredients-copy,
.section-note {
  margin: 12px 0 0;
  color: #56635a;
  font-size: 0.88rem;
  line-height: 1.55;
}

.alternative-list {
  margin-top: 12px;
}

.alternative {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  color: inherit;
  text-align: left;
}

.alternative:hover,
.alternative:focus-visible {
  background: #e9f2e8;
  outline: 2px solid #78ad80;
  outline-offset: 1px;
}

.product-alternative {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 42px;
  min-height: 66px;
}

.product-alternative img,
.alternative-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 7px;
  background: #e8efe7;
  object-fit: contain;
}

.alternative-placeholder {
  display: grid;
  place-items: center;
  color: #397548;
  font-size: 0.7rem;
  font-weight: 950;
}

.alternative-copy,
.alternative-copy strong,
.alternative-copy > span {
  display: block;
  min-width: 0;
}

.alternative-copy strong,
.alternative-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alternative-copy > span {
  margin-top: 4px;
}

.alternative-score {
  display: grid !important;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 3px solid var(--alternative-color);
  border-radius: 50%;
  color: #243229 !important;
  font-size: 0.8rem !important;
  font-weight: 950;
}

.alternative-empty {
  margin: 12px 0 0;
  padding: 13px;
  border-radius: 8px;
  background: #f3f5f2;
  color: #5d6961;
  font-size: 0.84rem;
  line-height: 1.45;
}

.row-arrow {
  color: #68756c;
  font-size: 1.5rem;
}

.additive-item {
  padding: 0;
  border-bottom: 1px solid rgba(23, 34, 27, 0.08);
}

.additive-item > button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 18px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.additive-item > button:focus-visible {
  outline: 3px solid rgba(33, 122, 72, 0.25);
  outline-offset: 2px;
}

.additive-item button strong,
.additive-item button div > span {
  display: block;
}

.additive-item button div > span {
  margin-top: 3px;
  color: #68756c;
  font-size: 0.78rem;
}

.additive-row-arrow {
  color: #68756c;
  font-size: 1.45rem;
  line-height: 1;
}

.risk-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d17f0a;
}

.risk-dot.low,
.risk-pill.low {
  background: #e8f4e9;
  color: #397e43;
}

.risk-dot.moderate,
.risk-pill.moderate {
  background: #fff2d9;
  color: #a86400;
}

.risk-dot.review,
.risk-pill.review {
  background: #eef0ee;
  color: #5f6962;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.assessment-list > .exposure-assessment {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px;
  border-radius: 8px;
  background: #f4f7f2;
}

.exposure-assessment > div {
  min-width: 0;
}

.exposure-assessment strong,
.exposure-assessment > div > span,
.exposure-assessment small {
  display: block;
}

.exposure-assessment > div > span {
  margin-top: 4px;
  color: #59665d;
  font-size: 0.82rem;
  line-height: 1.4;
}

.exposure-assessment small {
  margin-top: 6px;
  color: #7a857d;
  font-size: 0.72rem;
  line-height: 1.35;
}

.exposure-assessment > .risk-pill {
  flex: 0 0 auto;
  max-width: 112px;
  text-align: center;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.result-actions button {
  min-height: 48px;
  font-size: 0.82rem;
}

.contribution-link {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #356f45;
  font-size: 0.8rem;
  font-weight: 900;
}

.contribution-prompt {
  display: grid;
  gap: 10px;
}

.contribution-prompt p {
  margin: 0;
  color: #5d6961;
  line-height: 1.45;
}

.contribution-prompt button {
  width: 100%;
  font-size: 0.84rem;
}

.chip-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chip,
.risk-item,
.alternative,
.basket-item {
  border-radius: 10px;
  background: #f4f7f2;
  padding: 10px 12px;
}

.chip {
  min-height: 52px;
}

.chip strong,
.risk-item strong,
.alternative strong,
.basket-item strong {
  display: block;
}

.chip span,
.risk-item span,
.alternative span,
.basket-item span {
  color: #657169;
  font-size: 0.9rem;
}

.risk-item.high {
  background: #fff0ea;
}

.risk-item.medium {
  background: #fff8db;
}

.risk-item.low {
  background: #edf8ef;
}

.basket-summary {
  padding: 16px;
}

.history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.history-edit-button {
  width: auto;
  min-width: 52px;
  padding: 0 11px;
  font-size: 0.78rem;
  font-weight: 850;
}

.history-edit-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.history-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.history-list.is-editing .history-row {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.history-list.is-editing .history-item {
  cursor: default;
}

.history-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 42px;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: #17221b;
  text-align: left;
}

.history-item:hover,
.history-item:focus-visible {
  border-color: #78ad80;
  outline: 2px solid rgba(120, 173, 128, 0.38);
  outline-offset: 1px;
}

.history-item img,
.history-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #edf3ec;
  object-fit: contain;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: #1f7a4c;
  font-size: 0.76rem;
  font-weight: 950;
}

.history-copy,
.history-copy strong,
.history-copy > span {
  display: block;
  min-width: 0;
}

.history-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy > span {
  margin-top: 4px;
  overflow: hidden;
  color: #6b776e;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-score {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 3px solid var(--history-color);
  border-radius: 50%;
  color: #243229;
  font-size: 0.82rem;
  font-weight: 950;
}

.history-remove {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f8e8e6;
  color: #b3362f;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.history-remove:hover,
.history-remove:focus-visible {
  background: #f3d4d0;
  outline: 2px solid rgba(179, 54, 47, 0.3);
  outline-offset: 1px;
}

.history-limit-button {
  min-height: 44px;
  border: 1px solid #d8a94c;
  border-radius: 8px;
  background: #fff8e8;
  color: #76500a;
  font-size: 0.8rem;
  font-weight: 900;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric {
  min-height: 110px;
  padding: 16px 10px;
  text-align: center;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  font-size: 1.8rem;
  font-weight: 950;
}

.metric p {
  margin-bottom: 0;
  color: #637166;
  font-size: 0.86rem;
  font-weight: 800;
}

.insight-strip {
  margin-top: 12px;
  padding: 14px;
  color: #415046;
  font-weight: 800;
}

.notes-panel {
  max-width: 420px;
  padding: 24px;
}

.notes-panel p,
.notes-panel li {
  color: #4d5a51;
  line-height: 1.55;
}

.notes-panel ul {
  padding-left: 18px;
  margin-bottom: 0;
}

.preferences {
  width: min(92vw, 390px);
  border: 0;
  padding: 0;
  background: transparent;
}

.membership-dialog {
  width: min(92vw, 410px);
  max-height: min(88vh, 680px);
  border: 0;
  padding: 0;
  border-radius: 16px;
  background: #ffffff;
  color: #17221b;
  box-shadow: 0 24px 70px rgba(22, 36, 27, 0.28);
  overflow: auto;
}

.contribution-dialog {
  width: min(94vw, 440px);
  max-height: min(92vh, 760px);
  border: 0;
  padding: 0;
  border-radius: 16px;
  background: #ffffff;
  color: #17221b;
  box-shadow: 0 24px 70px rgba(22, 36, 27, 0.28);
  overflow: auto;
}

.contribution-dialog::backdrop {
  background: rgba(23, 34, 27, 0.48);
}

.contribution-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.contribution-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.contribution-context {
  margin: 2px 0 4px;
  color: #5f6b63;
  font-size: 0.82rem;
  line-height: 1.45;
}

.contribution-dialog label {
  display: grid;
  gap: 6px;
  color: #344239;
  font-size: 0.8rem;
  font-weight: 850;
}

.contribution-dialog [hidden] {
  display: none;
}

.contribution-dialog input,
.contribution-dialog select,
.contribution-dialog textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(23, 34, 27, 0.16);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdf9;
  color: #17221b;
}

.contribution-dialog textarea {
  min-height: 90px;
}

.contribution-dialog input[type="file"] {
  min-height: 48px;
  padding: 8px;
  font-size: 0.75rem;
  font-weight: 650;
}

.optional-label {
  color: #77827a;
  font-weight: 650;
}

.contribution-dialog .form-status {
  min-height: 18px;
  margin: 0;
}

.contribution-dialog .dialog-actions {
  margin-top: 2px;
}

.contribution-dialog .dialog-actions button {
  font-size: 0.82rem;
}

#confirmContribution {
  grid-column: 1 / -1;
}

.membership-dialog::backdrop {
  background: rgba(23, 34, 27, 0.48);
}

.membership-dialog > div {
  padding: 18px;
}

.membership-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.membership-price {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0 7px;
  margin-top: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(23, 34, 27, 0.1);
}

.membership-trial-offer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #b9d8bd;
  border-radius: 8px;
  background: #edf7ee;
}

.membership-trial-offer strong {
  font-size: 1.05rem;
}

.membership-trial-offer span {
  color: #397548;
  font-size: 0.8rem;
  font-weight: 850;
}

.membership-trial-offer + .membership-price {
  margin-top: 16px;
}

.membership-price strong {
  font-size: 2.25rem;
  line-height: 1;
}

.membership-price > span {
  color: #56635a;
  font-weight: 800;
}

.membership-price small {
  grid-column: 1 / -1;
  margin-top: 7px;
  color: #758078;
}

.membership-entitlements {
  display: grid;
  margin-top: 12px;
}

.membership-entitlements > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  border-bottom: 1px solid rgba(23, 34, 27, 0.08);
}

.membership-entitlements span {
  color: #4f5d53;
  font-size: 0.82rem;
  text-align: right;
}

.membership-active-status {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding: 14px 0;
  border-block: 1px solid rgba(23, 34, 27, 0.1);
}

.membership-active-status > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e7f4e7;
  color: #2f8144;
  font-weight: 950;
}

.membership-active-status strong,
.membership-active-status small {
  display: block;
}

.membership-active-status small {
  margin-top: 3px;
  color: #68756c;
}

.membership-primary {
  width: 100%;
  margin-top: 18px;
}

.membership-primary:disabled {
  cursor: wait;
  opacity: 0.68;
}

.membership-link-button {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #356f45;
  font-size: 0.82rem;
  font-weight: 900;
}

.membership-demo-note,
.membership-message {
  margin: 12px 0 0;
  color: #78837b;
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.membership-limit-copy {
  margin: 14px 0 0;
  color: #4f5d53;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
}

.membership-message {
  min-height: 17px;
  color: #397e43;
}

.membership-message.error {
  color: #a72f27;
}

.alternative-dialog {
  width: min(92vw, 410px);
  border: 0;
  padding: 0;
  border-radius: 16px;
  background: #ffffff;
  color: #17221b;
  box-shadow: 0 24px 70px rgba(22, 36, 27, 0.28);
}

.additive-dialog {
  width: min(94vw, 430px);
  max-height: min(94vh, 820px);
  border: 0;
  padding: 0;
  border-radius: 16px;
  background: #f4f7f3;
  color: #17221b;
  box-shadow: 0 24px 70px rgba(22, 36, 27, 0.3);
  overflow: auto;
}

.additive-dialog::backdrop {
  background: rgba(23, 34, 27, 0.48);
}

.additive-dialog > article {
  min-height: 100%;
}

.additive-dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid rgba(23, 34, 27, 0.1);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.additive-dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.additive-back-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(23, 34, 27, 0.1);
  border-radius: 50%;
  background: #f5f7f4;
  color: #24332a;
  font-size: 2rem;
  line-height: 1;
}

.additive-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid rgba(23, 34, 27, 0.08);
  background: #ffffff;
}

.additive-risk-label,
.additive-role-label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.additive-risk-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.additive-risk-label.low {
  background: #e5f3e7;
  color: #2f7840;
}

.additive-risk-label.moderate {
  background: #fff0d4;
  color: #986000;
}

.additive-risk-label.review {
  background: #ecefed;
  color: #5b6760;
}

.additive-role-label {
  background: #f1f3ef;
  color: #435148;
}

.additive-detail-section {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(23, 34, 27, 0.08);
  background: #ffffff;
}

.effect-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.effect-chip-list span {
  padding: 9px 11px;
  border-radius: 6px;
  background: #f1f4f1;
  color: #38463d;
  font-size: 0.82rem;
  line-height: 1.25;
}

.additive-explanation,
.evidence-context {
  margin: 12px 0 0;
  color: #35433a;
  line-height: 1.55;
}

.evidence-context {
  padding: 12px;
  border-left: 3px solid #78a98a;
  background: #f2f6f2;
  color: #536057;
  font-size: 0.82rem;
}

.additive-source-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.additive-source-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(23, 34, 27, 0.09);
  border-radius: 6px;
  background: #f7f9f6;
  color: #243229;
  text-decoration: none;
}

.additive-source-list strong,
.additive-source-list small {
  display: block;
}

.additive-source-list strong {
  line-height: 1.35;
}

.additive-source-list small {
  margin-top: 5px;
  color: #68756c;
  font-size: 0.72rem;
  line-height: 1.35;
}

.additive-source-list b {
  color: #657269;
  font-size: 1.5rem;
  font-weight: 500;
}

.additive-disclaimer {
  margin: 0;
  padding: 16px 18px max(18px, env(safe-area-inset-bottom));
  color: #6a766e;
  font-size: 0.74rem;
  line-height: 1.45;
}

.alternative-dialog::backdrop {
  background: rgba(23, 34, 27, 0.45);
}

.alternative-dialog > div {
  padding: 18px;
}

.alternative-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.alternative-context {
  margin: 18px 0 0;
  color: #56635a;
  line-height: 1.5;
}

.comparison-checklist {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.comparison-checklist > div {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
}

.comparison-checklist span {
  color: #2f8c4e;
  font-weight: 950;
}

.comparison-checklist p {
  margin: 0;
  color: #415046;
  line-height: 1.4;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.dialog-actions .secondary-button {
  font-size: 0.88rem;
}

.preferences::backdrop {
  background: rgba(23, 34, 27, 0.38);
}

.preferences form {
  padding: 18px;
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid rgba(23, 34, 27, 0.12);
  border-radius: 12px;
}

legend {
  padding: 0 6px;
  font-weight: 900;
}

fieldset label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  color: #425049;
  font-weight: 700;
}

.preferences .primary-button {
  width: 100%;
  margin-top: 16px;
}

@media (max-width: 840px) {
  input:not([type="file"]),
  textarea,
  select {
    font-size: 16px;
  }

  .additive-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .additive-dialog-header {
    padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  .phone-frame {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(86px, calc(70px + env(safe-area-inset-bottom))) max(20px, env(safe-area-inset-left));
  }

  .tabs {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 0;
    width: min(100%, 430px);
    margin: 0;
    padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 28px rgba(27, 43, 32, 0.14);
    transform: translateX(-50%);
  }

  .tab {
    min-width: 0;
    font-size: 0.72rem;
  }

  .scan-action {
    align-self: start;
    justify-self: center;
    flex-direction: column;
    gap: 1px;
    width: 68px;
    height: 68px;
    margin-top: -24px;
    border: 4px solid #eef4ed;
    border-radius: 50%;
    background: #154f38;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(21, 79, 56, 0.28);
  }

  .scan-action img {
    width: 30px;
    height: 30px;
    border-radius: 5px;
  }

  .scan-action span {
    line-height: 1;
  }

  .notes-panel {
    display: none;
  }
}

@media (max-width: 390px) {
  .phone-frame {
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(82px, calc(68px + env(safe-area-inset-bottom))) max(14px, env(safe-area-inset-left));
  }

  .tab {
    font-size: 0.68rem;
  }

  .topbar-actions {
    gap: 6px;
  }

  .membership-button {
    max-width: 72px;
    padding: 0 8px;
  }

  .score-row {
    grid-template-columns: 78px 1fr;
  }

  .product-row {
    grid-template-columns: 78px 1fr;
  }

  .score-ring {
    width: 78px;
    height: 78px;
  }

  .product-image {
    width: 78px;
    height: 78px;
  }

  .product-placeholder {
    width: 78px;
    height: 78px;
  }

  .score-ring span {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }

  .assessment-list > .exposure-assessment {
    display: grid;
  }

  .exposure-assessment > .risk-pill {
    max-width: none;
    justify-self: start;
  }
}
