:root {
  color-scheme: light;
  font: 100%/1.5 system-ui, sans-serif;
  color: #1c3127;
  background: #f0f3ec;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 48rem; margin: auto; padding: clamp(1rem, 5vw, 3rem); }
header, footer, .search-row { display: flex; gap: .65rem; align-items: center; }
header, footer { justify-content: space-between; }
.version { margin-left: auto; color: #45594e; font: .8rem/1.2 ui-monospace, monospace; }
.menu-toggle { display: grid; align-content: center; gap: .28rem; width: 3rem; min-height: 3rem; padding: .6rem; }
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: #184936; }
#app-menu { position: absolute; z-index: 4; top: 5rem; right: max(1rem, calc((100vw - 42rem) / 2)); display: grid; width: min(16rem, calc(100vw - 2rem)); padding: .5rem; border: 1px solid #cbd7cb; border-radius: .85rem; background: #fff; box-shadow: 0 .5rem 1.5rem #1c31271f; }
#app-menu[hidden] { display: none; }
#app-menu button { width: 100%; text-align: left; border: 0; }
.brand {
  display: grid;
  place-items: center;
  width: 3rem;
  aspect-ratio: 1;
  border-radius: 1rem;
  background: #184936;
  color: #f1f6ed;
  font-size: 1.55rem;
  font-weight: 750;
}
#settings {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding: clamp(1rem, 5vw, 3rem);
  background: #f0f3ec;
}
#history-page {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding: clamp(1rem, 5vw, 3rem);
  background: #f0f3ec;
}
#settings .settings-header, #history-page .settings-header {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 0 1rem;
  border-bottom: 1px solid #cbd7cb;
}
#settings .settings-header h1, #history-page .settings-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.02em; }
#settings .settings-content, #history-page .settings-content { max-width: 48rem; margin: 2rem auto; }
#history-list { display: grid; gap: .6rem; }
.history-entry { position: relative; display: flex; width: 100%; min-height: 4.25rem; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.1rem; text-align: left; background: #fff; border-color: #dbe3d8; }
.history-summary { display: flex; min-width: 0; align-items: center; gap: .6rem; }
.history-query { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.history-method { flex: 0 0 auto; padding: .08rem .45rem; border-radius: .4rem; color: #184936; background: #e2f1e6; font-size: .8rem; }
.history-date { flex: 0 0 auto; color: #45594e; font-size: .85rem; }
.history-synced { position: absolute; right: .65rem; bottom: .22rem; color: #16834a; font-size: .85rem; font-weight: 800; line-height: 1; }
@media (max-width: 30rem) {
  .history-entry { align-items: flex-start; flex-direction: column; justify-content: center; gap: .2rem; }
  .history-date { font-size: .8rem; }
}
.history-photo { display: block; max-width: min(100%, 34rem); max-height: 60vh; margin: 1rem 0; object-fit: contain; object-position: left; }
.history-transcript { white-space: pre-wrap; padding: 1rem; background: #fff; border-radius: .75rem; }
.history-results { list-style: none; padding: 0; display: grid; gap: .5rem; }
.history-results li { padding: .8rem; border: 1px solid #dbe3d8; border-radius: .75rem; background: #fff; }
#settings #account-section, #settings .settings-preferences, #settings .settings-update { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #cbd7cb; }
#settings #account-section h2, #settings .settings-preferences h2, #settings .settings-update h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
#settings #login-form { max-width: 28rem; }
#settings #login-button { margin-top: .4rem; }
#settings input { display: block; width: 100%; margin: .4rem 0; }
#settings .setting-option { display: flex; align-items: center; gap: .65rem; margin: 1rem 0 .75rem; }
#settings .setting-option input { width: 1.1rem; min-height: 1.1rem; margin: 0; }
#recognized-text { margin-top: 1rem; }
#recognized-text textarea { display: block; width: 100%; margin-top: .45rem; padding: .55rem .75rem; font: inherit; color: inherit; border: 1px solid #82978c; border-radius: .65rem; }
#settings p { margin: .4rem 0 .8rem; }
h1 { margin: 1.4rem 0 .1rem; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.12; letter-spacing: -.045em; }
.intro { margin: .55rem 0 1.8rem; color: #45594e; }
label { display: block; font-weight: 650; margin-bottom: .45rem; }
button, input { font: inherit; min-height: 3rem; border-radius: .65rem; }
button { cursor: pointer; padding: .5rem .9rem; border: 1px solid #82978c; background: transparent; color: #184936; font-weight: 650; }
button:disabled { cursor: wait; opacity: .65; }
button.primary { color: white; background: #184936; border-color: #184936; }
input { width: 100%; min-width: 0; border: 1px solid #82978c; background: #fff; color: inherit; padding: .55rem .75rem; }
.capture { margin-top: .75rem; }
#label-scan { margin-top: 1rem; }
#online-reading { margin-top: 1rem; }
#online-reading input { margin-bottom: .65rem; }
#online-reading p { margin: .45rem 0 0; }
#ocr-status:empty { display: none; }
#ingredients {
  display: block;
  width: 100%;
  margin-bottom: .65rem;
  padding: .55rem .75rem;
  resize: vertical;
  font: inherit;
  color: inherit;
  border: 1px solid #82978c;
  border-radius: .65rem;
}
:focus-visible { outline: 3px solid #497b61; outline-offset: 3px; }
#feedback:empty, #results:empty { display: none; }
#feedback { margin: 1rem 0 0; }
#results { list-style: none; padding: 0; display: grid; gap: .55rem; margin: 1.2rem 0 0; }
#results li, .result-cards li { display: grid; grid-template-columns: 4.1rem minmax(0, 1fr) 2.75rem; gap: .5rem; align-items: center; padding: .85rem; background: white; border: 1px solid #dbe3d8; border-radius: .85rem; }
.result-cards { list-style: none; padding: 0; display: grid; gap: .55rem; margin: 1rem 0; }
.code { font-weight: 750; font-variant-numeric: tabular-nums; }
.name { font-weight: 650; }
.risk { display: table; margin-top: .25rem; padding: .12rem .55rem; border-radius: .45rem; font-size: .9rem; color: #36483f; background: #edf1ee; }
.risk[data-level="0"], .risk[data-level="1"] { color: #8a222e; background: #f9e5e7; }
.risk[data-level="2"] { color: #704607; background: #fff0cc; }
.risk[data-level="4"] { color: #195339; background: #e2f1e6; }
.risk-icon { width: 2.75rem; height: 2.7rem; object-fit: contain; }
footer { margin-top: 2rem; padding-top: .9rem; border-top: 1px solid #cbd7cb; flex-wrap: wrap; font-size: .9rem; color: #45594e; }
footer p { margin: .15rem 0; }
a { color: #184936; }
