/* ============================================================================
   NutrientLabel — app.css
   Design tone: print-studio paper feel + ingredient palette.
   Paper-white background / deep-ink text / forest-green primary / clay-orange accent; the four
   nutrient colors appear only where semantic (ingredient-row calorie source, energy bar, category
   markers), never as pure decoration.
   ========================================================================= */

:root {
  /* Paper and ink */
  --paper:      #FAF6EF;
  --paper-2:    #F4EDE1;
  --card:       #FFFFFF;
  --ink:        #17130E;
  --ink-2:      #4E453B;
  --ink-3:      #8A7D6D;
  --line:       #E7DBC9;
  --line-soft:  #F1E9DC;

  /* Brand */
  --forest:     #1E4D3B;
  --forest-2:   #2C6A51;
  --forest-tint:#EAF1EC;
  --clay:       #A8402A;
  --clay-tint:  #FBEDE7;

  /* Nutrient colors (semantic only, not decorative) */
  --c-fat:      #C2410C;
  --c-carb:     #B08A2E;
  --c-protein:  #8C2340;
  --c-vit:      #1D6B66;

  --warn:       #9A6B00;
  --warn-tint:  #FDF4DE;
  --bad:        #A32B22;
  --bad-tint:   #FBEAE7;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --shadow-1: 0 1px 2px rgba(23, 19, 14, .05);
  --shadow-2: 0 2px 4px rgba(23, 19, 14, .05), 0 12px 28px -18px rgba(23, 19, 14, .35);
  --shadow-3: 0 4px 10px rgba(23, 19, 14, .06), 0 30px 60px -30px rgba(23, 19, 14, .45);

  --serif: "Libre Bodoni", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, #FFFDF9 0%, rgba(255,253,249,0) 60%),
    radial-gradient(900px 500px at 100% 0%, #F6EEE0 0%, rgba(246,238,224,0) 55%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
}

/* Four-color hairline at the top: the site's signature; these colors appear together only here */
.topline { display: flex; height: 3px; }
.topline i { flex: 1; }
.topline .t1 { background: var(--c-fat); }
.topline .t2 { background: var(--c-carb); }
.topline .t3 { background: var(--c-protein); }
.topline .t4 { background: var(--forest); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 32px;
  padding: 14px max(24px, calc((100vw - 1280px) / 2));
  background: rgba(250, 246, 239, .86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 22px; height: 22px; display: block; }
.brand-name {
  font-family: var(--serif); font-size: 20px; letter-spacing: -.015em; font-weight: 500;
}
.brand-name.sm { font-size: 17px; }

.nav { display: flex; gap: 26px; margin-left: 8px; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 0; border-bottom: 1px solid transparent; transition: color .18s, border-color .18s;
}
.nav a:hover { color: var(--forest); border-bottom-color: var(--forest); }

.topbar-right { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; }
.nav-toggle {
  display: none; width: 44px; height: 44px; place-items: center; flex: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; display: block; }
.nav-toggle:hover { border-color: #D6C6AE; }
.pill {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
}
.pill-forest { background: var(--forest-tint); color: var(--forest); border: 1px solid #CFE0D5; }
.pill-ghost { border: 1px solid var(--line); color: var(--ink-2); background: #fff; }

/* ---------------------------------------------------------------- layout */
main { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 56px;
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 22px;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-carb); box-shadow: 0 0 0 3px rgba(176,138,46,.16);
}
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 4.6vw, 62px); line-height: .99; letter-spacing: -.028em;
  margin: 0 0 22px; text-wrap: balance;
}
.hero h1 em { font-style: italic; color: var(--clay); }
.lede {
  font-size: 16.5px; line-height: 1.62; color: var(--ink-2); max-width: 56ch; margin: 0 0 34px;
}

.steps { display: flex; gap: 30px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: baseline; gap: 9px; }
.step-n {
  font-family: var(--mono); font-size: 11px; color: var(--c-protein);
  letter-spacing: .04em; font-weight: 600;
}
.step-t { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }

.hero-aside {
  background: linear-gradient(180deg, #fff, #FCFAF5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px 24px 10px; box-shadow: var(--shadow-1); align-self: start;
}
.aside-title {
  font-family: var(--serif); font-size: 17px; font-weight: 500;
  margin: 0 0 16px; letter-spacing: -.01em;
}
.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
  display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 11px;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
  font-size: 13.5px; line-height: 1.5; color: var(--ink-2);
}
.checks li:first-child { border-top: 0; }
.checks b { color: var(--ink); font-weight: 600; }
.ck { width: 8px; height: 8px; border-radius: 2px; margin-top: 6px; display: block; }
.ck-forest { background: var(--forest); }
.ck-carb { background: var(--c-carb); }
.ck-protein { background: var(--c-protein); }
.ck-vit { background: var(--c-vit); }
.ck-clay { background: var(--clay); }

/* ---------------------------------------------------------------- studio */
.studio {
  display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 44px;
  padding: 48px 0 72px; align-items: start;
}

.editor { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px 26px 24px;
  box-shadow: var(--shadow-1); min-width: 0;
}
.card-head { margin-bottom: 20px; }
.card-eyebrow {
  display: flex; align-items: center; gap: 8px; margin: 0 0 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3);
}
.sw { width: 7px; height: 7px; border-radius: 2px; display: block; }
.sw-forest { background: var(--forest); }
.sw-carb { background: var(--c-carb); }
.sw-protein { background: var(--c-protein); }
.sw-vit { background: var(--c-vit); }
.sw-clay { background: var(--clay); }

.card-title {
  font-family: var(--serif); font-size: 22px; font-weight: 500;
  letter-spacing: -.018em; margin: 0; display: flex; align-items: baseline; gap: 12px;
}
.card-note {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  letter-spacing: 0; font-variant-numeric: tabular-nums;
}

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-2.tight { margin-top: 16px; }

/* ---------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label {
  font-size: 11px; font-weight: 600; letter-spacing: .085em; text-transform: uppercase;
  color: var(--ink-3);
}
.field-label em { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .75; }
.field-hint { font-size: 12px; line-height: 1.45; color: var(--ink-3); }

input[type="text"], input[type="number"], select {
  width: 100%; max-width: 100%; min-width: 0; height: 44px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #FFFDFA; color: var(--ink);
  font-family: var(--sans); font-size: 14.5px; font-variant-numeric: tabular-nums;
  transition: border-color .16s, box-shadow .16s, background .16s;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238A7D6D' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
input:hover, select:hover { border-color: #D8C9B2; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: none; border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(30, 77, 59, .16); background: #fff;
}
input::placeholder { color: #B3A695; }

.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix input { padding-right: 56px; }
.input-suffix span {
  position: absolute; right: 13px; font-size: 12px; color: var(--ink-3); pointer-events: none;
}

/* ------------------------------------------------------------- Segmented control */
.seg {
  display: flex; height: 44px; padding: 3px; gap: 3px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 6px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: background .16s, color .16s, box-shadow .16s;
  min-height: 36px;
}
.seg button:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.seg button.on {
  background: var(--forest); color: #F4FAF6; font-weight: 600;
  box-shadow: 0 1px 2px rgba(30,77,59,.28);
}

/* ------------------------------------------------------------ ingredients */
.ing-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 168px 34px; gap: 10px;
  padding: 0 0 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.ing-head span:nth-child(2) { padding-left: 2px; }

.ing-list { display: flex; flex-direction: column; gap: 8px; }

.ing-row {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 34px; gap: 10px; align-items: start;
  padding: 9px 10px 9px 13px;
  background: #FFFDFA; border: 1px solid var(--line-soft); border-radius: var(--r-md);
  transition: border-color .16s, background .16s;
}
.ing-row:hover { border-color: var(--line); }
.ing-row::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px 0 0 3px; background: var(--ing-c, var(--line));
}
.ing-row.is-fat { --ing-c: var(--c-fat); }
.ing-row.is-carb { --ing-c: var(--c-carb); }
.ing-row.is-protein { --ing-c: var(--c-protein); }
.ing-row.is-none { --ing-c: #CFC3B0; }

.ing-main { min-width: 0; }
.ing-search-wrap { position: relative; }
.ing-search {
  width: 100%; height: 34px; padding: 0 9px;
  border: 1px solid var(--line-soft); border-radius: 6px; background: #fff;
  font-size: 14px; color: var(--ink); font-weight: 500;
}
.ing-search:hover { border-color: var(--line); }
.ing-search:focus-visible { background: #fff; }

/* Sub-row: data on the left, "count as added sugar" toggle on the right; toggle appears only when the food actually contains sugars */
.ing-sub {
  display: flex; align-items: baseline; gap: 10px; justify-content: space-between;
  padding: 3px 2px 0 1px; min-height: 20px;
}
.ing-meta {
  font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ing-meta.warnish { color: var(--bad); white-space: normal; }

.sug-t {
  flex: none; height: 21px; padding: 0 8px; border-radius: 999px; cursor: pointer;
  border: 1px dashed #DCCDB4; background: transparent; color: var(--ink-3);
  font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  transition: all .16s; white-space: nowrap;
}
.sug-t:hover { border-color: var(--c-carb); color: #7A5E13; background: #FDF8EA; }
.sug-t.on {
  border-style: solid; border-color: #E0C98A; background: #FBF1D6; color: #7A5E13;
}
.sug-t.on::before { content: "✓ "; }

.ing-qty { display: flex; gap: 6px; }
.ing-amt {
  width: 66px !important; height: 34px !important; padding: 0 8px !important;
  font-size: 14px !important; text-align: right;
}
.ing-unit {
  flex: 1; min-width: 0; height: 34px !important; padding: 0 24px 0 8px !important;
  font-size: 12.5px !important; background-position: right 8px center !important;
}

.ing-del {
  width: 34px; height: 34px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--ink-3); cursor: pointer;
  display: grid; place-items: center; transition: color .16s, background .16s, border-color .16s;
}
.ing-del:hover { color: var(--bad); background: var(--bad-tint); border-color: #F0D2CD; }
.ing-del svg { width: 14px; height: 14px; }


/* Search results dropdown */
.suggest {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); max-height: 268px; overflow: auto; padding: 5px;
}
.suggest[hidden] { display: none; }
.sg {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 8px 9px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
}
.sg:hover, .sg.active { background: var(--forest-tint); }
.sg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-meta { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-meta .f { color: var(--forest); font-weight: 600; }

.ing-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.ing-foot {
  margin: 14px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-3);
  border-top: 1px solid var(--line-soft); padding-top: 12px;
}

/* ------------------------------------------- ingredient statement + allergens (card 04) */
.ing-allergens { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 1px 0; }
.ing-allergens[hidden] { display: none; }
.alg-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--clay-tint); color: #8A3320; border: 1px solid #F0D8CE;
}
.alg-chip-review { background: var(--warn-tint); color: #6B4A00; border-color: #EAD9A8; }

.alg-toggle, .alg-confirm {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #FFFDFA; cursor: pointer;
  transition: border-color .16s, background .16s;
}
.alg-toggle:hover, .alg-confirm:hover { border-color: #D6C6AE; }
.alg-toggle input[type="checkbox"], .alg-confirm input[type="checkbox"] {
  width: 18px; height: 18px; margin: 1px 0 0; flex: none;
  accent-color: var(--forest); cursor: pointer;
}
.alg-toggle-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.alg-toggle-text b { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.alg-toggle-text span { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

.alg-contains { margin-top: 16px; }
.alg-contains-text {
  margin: 0; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--clay-tint); color: #7E2A1A; font-weight: 700; font-size: 14.5px; line-height: 1.5;
  border-left: 3px solid var(--clay);
}
.alg-none {
  margin: 0; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--forest-tint); color: #234A38; font-size: 13.5px; font-weight: 600; line-height: 1.5;
  border-left: 3px solid var(--forest-2);
}
.alg-contains-cap { margin: 7px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.alg-empty { margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.55; }

.alg-review {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-tint); border-left: 3px solid #D7A32A;
}
.alg-review[hidden] { display: none; }
.alg-review-head { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: #6B4A00; }
.alg-review-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.alg-review-list li { font-size: 12.5px; line-height: 1.5; color: #6B4A00; }
.alg-review-list b { font-weight: 700; }

.alg-names-wrap { margin-top: 18px; }
.alg-names-wrap[hidden] { display: none; }
.alg-names-head {
  display: grid; grid-template-columns: 1fr 80px; gap: 10px; padding: 0 0 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.alg-names-head span:last-child { text-align: right; }
.alg-names { display: flex; flex-direction: column; gap: 7px; }
.alg-name-row { display: grid; grid-template-columns: 1fr 80px; gap: 10px; align-items: center; }
.alg-name-input { height: 38px !important; font-size: 13.5px !important; }
.alg-name-wt {
  font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right;
}
.alg-names-foot { margin: 9px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.alg-confirm { margin-top: 16px; }
.alg-confirm[hidden] { display: none; }
.alg-confirm-text { font-size: 13px; line-height: 1.5; color: var(--ink-2); }

.alg-foot {
  margin: 16px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-3);
  border-top: 1px solid var(--line-soft); padding-top: 12px;
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 15px; border-radius: var(--r-sm);
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .16s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn-primary {
  background: var(--forest); color: #F6FBF7; border-color: var(--forest);
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 2px 6px -2px rgba(30,77,59,.5);
  width: 100%; height: 46px; font-size: 14.5px;
}
.btn-primary:hover { background: var(--forest-2); border-color: var(--forest-2); }
.btn-primary:active { transform: translateY(.5px); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #D6C6AE; background: #FFFDF8; }
.btn-quiet { background: transparent; color: var(--ink-3); }
.btn-quiet:hover { color: var(--forest); background: var(--forest-tint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --------------------------------------------------------------- preview */
.preview { position: sticky; top: 78px; min-width: 0; }
.preview-inner {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-2);
}
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.preview-tools { display: flex; align-items: center; gap: 9px; }
.chip {
  height: 24px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  transition: all .16s;
}
.chip:hover { border-color: #D6C6AE; color: var(--ink-2); }
.chip.on { background: var(--clay-tint); border-color: #E6C4B6; color: var(--clay); }
.preview-size {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.paper {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(23,19,14,.018) 0 1px, transparent 1px 3px),
    #fff;
  border-radius: var(--r-md);
  padding: 20px;
  display: grid; place-items: center;
  min-height: 300px;
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(23,19,14,.04);
}
.label-mount { width: 100%; display: grid; place-items: center; }
.label-mount svg {
  width: auto; max-width: 100%; height: auto;
  max-height: 540px;
  filter: drop-shadow(0 2px 5px rgba(23,19,14,.10));
}
.paper-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12.5px; color: var(--ink-3); background: rgba(255,255,255,.9);
  border-radius: var(--r-md);
}
.paper-loading[hidden] { display: none; }

/* Key numbers */
.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin: 16px 0 0; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden;
}
.fact { background: #fff; padding: 11px 12px; }
.fact-k {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px;
}
.fact-v {
  display: block; font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}

/* Energy breakdown bar */
.energy { margin-top: 16px; }
.energy-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; margin-bottom: 8px;
}
.energy-head span:last-child {
  font-family: var(--mono); letter-spacing: 0; text-transform: none; font-size: 11.5px;
}
.energy-bar {
  display: flex; gap: 2px; height: 9px; border-radius: 5px; overflow: hidden;
  background: var(--line-soft);
}
.energy-bar i { display: block; height: 100%; transition: flex-grow .3s ease; }
.energy-legend { display: flex; gap: 14px; margin-top: 9px; flex-wrap: wrap; }
.energy-legend span { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.energy-legend i { width: 7px; height: 7px; border-radius: 2px; }
.energy-legend b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Actions area */
.actions { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.actions-row { display: flex; gap: 8px; }
.actions-row .btn { flex: 1; }
.actions-note { font-size: 11px; line-height: 1.5; color: var(--ink-3); margin: 6px 0 0; }
.backup-nudge { font-size: 11px; line-height: 1.5; color: var(--ink-2); margin: 8px 0 0; padding: 8px 10px; border: 1px dashed rgba(30,77,59,.35); border-radius: 8px; background: rgba(30,77,59,.05); }

/* Compliance notices */
.compliance { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; }
.cmp {
  display: grid; grid-template-columns: 16px 1fr; gap: 9px;
  padding: 9px 11px; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.45;
}
.cmp svg { width: 16px; height: 16px; margin-top: 1px; }
.cmp-ok { background: var(--forest-tint); color: #234A38; }
.cmp-warn { background: var(--warn-tint); color: #6B4A00; }
.cmp-bad { background: var(--bad-tint); color: #7E211A; }

.note-strip {
  margin-top: 14px; padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--warn-tint); color: #6B4A00; font-size: 12.5px; line-height: 1.5;
  border-left: 3px solid #D7A32A;
}

/* ------------------------------------------------------------- Text sections */
.band { padding: 64px 0; border-top: 1px solid var(--line); }
.band-title {
  font-family: var(--serif); font-size: clamp(24px, 2.4vw, 32px); font-weight: 400;
  letter-spacing: -.02em; margin: 0 0 30px; text-wrap: balance;
}
.band-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.band-item { border-top: 1px solid var(--ink); padding-top: 16px; }
.band-num {
  font-family: var(--mono); font-size: 11px; color: var(--c-protein);
  letter-spacing: .1em; margin: 0 0 10px; font-weight: 600;
}
.band-item h3 {
  font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.25;
  margin: 0 0 10px; letter-spacing: -.012em;
}
.band-item p { margin: 0; font-size: 14px; line-height: 1.62; color: var(--ink-2); }

.band-rules { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; }
.rules-copy p { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); margin: 0 0 14px; max-width: 62ch; }
.rules-copy b { color: var(--ink); }
.rules-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; align-self: start; }
.rf { background: #fff; padding: 18px 16px; }
.rf-k { display: block; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; font-weight: 600; }
.rf-v { font-family: var(--serif); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ foot */
.foot {
  max-width: 1280px; margin: 0 auto; padding: 34px 24px 64px;
  border-top: 1px solid var(--line);
  display: flex; gap: 40px; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap;
}
.foot-left { display: flex; align-items: baseline; gap: 9px; font-size: 12.5px; color: var(--ink-3); }
.foot-sep { color: var(--line); }
.foot-note { font-size: 11.5px; line-height: 1.6; color: var(--ink-3); max-width: 62ch; margin: 0; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--ink); color: #FBF7F0; font-size: 13px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .studio { grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; }
  .hero { grid-template-columns: minmax(0, 1fr) 330px; gap: 36px; }
}
@media (max-width: 1024px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .preview-inner { max-width: 520px; margin: 0 auto; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .band-rules { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .band-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  /* Decorative trust pills repeat in hero/compare/faq; drop them so the header never overflows */
  .topbar-right .pill { display: none; }
}
@media (max-width: 760px) {
  main { padding: 0 16px; }
  .topbar { padding: 10px 16px; gap: 12px; }
  .hero { padding: 40px 0 36px; }
  .card { padding: 20px 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .ing-head { display: none; }
  .ing-row { grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
  .ing-qty { grid-column: 1 / 2; }
  .foot { padding: 26px 16px 48px; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* Hamburger + drawer nav replaces the inline links */
  .nav-toggle { display: grid; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    display: none; flex-direction: column; gap: 0; padding: 6px 16px 12px;
    background: rgba(250, 246, 239, .98);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2);
  }
  .nav.open { display: flex; }
  .nav a {
    display: flex; align-items: center; min-height: 44px;
    padding: 10px 4px; font-size: 15px; border-bottom: 1px solid var(--line-soft);
  }
  .nav a:last-child { border-bottom: 0; }

  /* Primary controls: tap target >= 44px */
  .ing-search { height: 44px; font-size: 16px; }
  .ing-amt { height: 44px !important; font-size: 16px !important; }
  .ing-unit { height: 44px !important; font-size: 16px !important; }
  .ing-del { width: 44px; height: 44px; }
  .ing-del svg { width: 16px; height: 16px; }
  .seg { height: auto; min-height: 50px; }
  .seg button { min-height: 44px; font-size: 14px; }
  .btn { height: 44px; }
  .alg-name-input { height: 44px !important; font-size: 16px !important; }
  .alg-toggle, .alg-confirm { min-height: 44px; align-items: center; }
  .foot-links a { padding: 7px 0; }
  /* Dense secondary toggles: >= 32px (WCAG 2.2 AA is 24px); 44px would distort these rows */
  .sug-t { height: auto; min-height: 32px; padding: 6px 10px; font-size: 11.5px; }
  .chip { height: auto; min-height: 32px; padding: 5px 11px; }

  /* iOS Safari auto-zooms on focus when a control's font is < 16px */
  input[type="text"], input[type="number"], select, textarea { font-size: 16px; }
}

/* Print: keep only the label itself */
@media print {
  body { background: #fff; }
  .topline, .topbar, .hero, .card, .band, .foot, .actions, .facts, .energy,
  .compliance, .preview-head, .actions-note, .backup-nudge, .note-strip, .toast { display: none !important; }
  .preview { position: static; }
  .preview-inner { border: 0; box-shadow: none; padding: 0; }
  .paper { border: 0; box-shadow: none; padding: 0; background: #fff; min-height: 0; }
  .label-mount svg { max-height: none; filter: none; }
}

/* ------------------------- License / upgrade ------------------------- */

.lic-badge {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.lic-badge:active { transform: translateY(.5px); }
.lic-badge-free {
  background: var(--clay); color: #FFF6EF;
  border: 1px solid #8F3520; box-shadow: var(--shadow-1);
}
.lic-badge-free:hover { box-shadow: 0 3px 10px rgba(168, 64, 42, .30); }
.lic-badge-pro {
  background: var(--forest-tint); color: var(--forest);
  border: 1px solid #CFE0D5;
}

.lic-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(23, 19, 14, .44);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lic-overlay[hidden] { display: none; }

.lic-card {
  position: relative;
  width: min(460px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 30px 30px 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
.lic-close {
  position: absolute; top: 12px; right: 14px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-3);
  padding: 4px 6px;
}
.lic-close:hover { color: var(--ink); }

.lic-eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--c-protein); margin: 0 0 8px;
}
.lic-title {
  font-family: var(--serif); font-weight: 500; font-size: 26px;
  line-height: 1.18; letter-spacing: -.015em; margin: 0 0 14px;
}
.lic-reason {
  background: var(--clay-tint); border: 1px solid #EBC6B8;
  color: #7C3221; font-size: 13.5px; line-height: 1.5;
  border-radius: var(--r-sm); padding: 10px 12px; margin: 0 0 14px;
}
.lic-list { list-style: none; margin: 0 0 18px; padding: 0; }
.lic-list li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.5; color: var(--ink-2);
  padding: 5px 0;
}
.lic-list .ck { margin-top: 5px; flex: none; }
.lic-list b { color: var(--ink); font-weight: 600; }

.lic-price {
  font-family: var(--serif); font-size: 34px; font-weight: 500;
  color: var(--ink); margin: 0 0 16px;
}
.lic-price span {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  color: var(--ink-3); margin-left: 6px;
}

.lic-buy { width: 100%; justify-content: center; }
.lic-alt { font-size: 13px; color: var(--ink-3); text-align: center; margin: 12px 0 0; }
.lic-link {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--forest); font-size: 13px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.lic-keybox { margin-top: 12px; }
.lic-keybox input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #FFFDFA; color: var(--ink);
  font-family: var(--mono); font-size: 13px;
  padding: 9px 11px; margin-bottom: 8px;
}
.lic-keybox input:focus { outline: 2px solid rgba(30, 77, 59, .25); border-color: var(--forest); }
.lic-key-err {
  color: var(--clay); font-size: 12.5px; line-height: 1.4; margin: 4px 0 0;
}
.lic-fine {
  font-size: 11.5px; line-height: 1.5; color: var(--ink-3);
  border-top: 1px solid var(--line-soft); padding-top: 12px; margin: 16px 0 0;
}

@media (max-width: 760px) {
  .lic-badge { display: none; }   /* hidden on small screens; the upgrade dialog opens automatically when an export is blocked */
}

/* -- footer compliance links --------------------------- */
.foot-links {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin: 8px 0 0;
}
.foot-links a {
  color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  text-decoration: none;
}
.foot-links a:hover { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.foot-mail { color: var(--forest); font-weight: 500; }

/* -- Full-bleed ambient background on wide screens (market vendor photo) --
   Shown only at >=1440px; fills the viewport, stronger at the sides,
   faint under the content area (~92% beige overlay) to keep body text readable */
@media (min-width: 1440px) {
  header, main, footer { position: relative; z-index: 1; }
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
      linear-gradient(to right,
        rgba(250,246,239,.14) 0%,
        rgba(250,246,239,.26) calc(50% - 700px),
        rgba(250,246,239,.92) calc(50% - 540px),
        rgba(250,246,239,.92) calc(50% + 540px),
        rgba(250,246,239,.26) calc(50% + 700px),
        rgba(250,246,239,.14) 100%),
      url("/assets/bg-vendor.jpg");
    background-size: cover, cover;
    background-position: center 30%, center 30%;
    background-repeat: no-repeat;
  }
}

/* -- Audience cards --------------------------------------- */
.seg-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-top: 28px;
}
.seg-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 22px 20px;
}
.seg-card p { margin: 0; font-size: 14px; line-height: 1.62; color: var(--ink-2); }
.seg-k {
  font-weight: 600; color: var(--ink); font-size: 15.5px !important;
  margin-bottom: 10px !important;
  padding-bottom: 10px; border-bottom: 2px solid var(--clay);
  display: inline-block;
}

/* -- Comparison table ------------------------------------- */
.band-compare .compare-wrap { margin-top: 28px; overflow-x: auto; }
.compare {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  font-size: 14px;
}
.compare th, .compare td {
  padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.compare thead th {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); background: var(--paper-deep, #F6EEE0); font-weight: 600;
}
.compare tbody th {
  font-weight: 600; color: var(--ink); font-size: 13.5px; width: 180px;
}
.compare td { color: var(--ink-2); line-height: 1.5; }
.compare .cmp-us { color: var(--forest); font-weight: 600; background: rgba(30,77,59,.045); }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
.compare-note {
  margin: 10px 2px 0; font-size: 12px; color: var(--ink-3);
}
@media (max-width: 760px) {
  .seg-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .compare tbody th { width: auto; }
}
@media (max-width: 520px) {
  .seg-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── FAQ ────────────────────────────────────────── */
.faq-list { margin-top: 24px; max-width: 780px; }
.faq-item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  margin-bottom: 10px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: 16px 20px;
  font-weight: 600; font-size: 15px; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 18px; color: var(--ink-3); font-weight: 400;
  transition: transform .15s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--forest); }
.faq-item[open] summary { border-bottom: 1px solid var(--line); }
.faq-item p { margin: 0; padding: 14px 20px 18px; font-size: 14px; line-height: 1.66; color: var(--ink-2); }

/* -- Closing CTA ------------------------------------------ */
.band-cta { text-align: center; }
.cta-sub { margin: 10px 0 22px; color: var(--ink-2); font-size: 15.5px; }
.cta-btn { display: inline-block; padding: 14px 34px; font-size: 16px; text-decoration: none; }

/* -- Paste-recipe modal ----------------------------------- */
.paste-card { width: min(560px, 100%); }
.paste-hint {
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
  margin: 0 0 12px;
}
.paste-hint b { color: var(--ink); }
.paste-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 14px; resize: vertical; min-height: 160px;
}
.paste-input:focus { outline: 2px solid var(--forest-2); outline-offset: -1px; }
.paste-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 16px;
}

/* -- My Recipes modal ------------------------------------- */
.recipes-card { width: min(600px, 100%); }
.recipes-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.recipes-list {
  max-height: min(46vh, 420px); overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff;
}
.recipes-empty { margin: 0; padding: 22px 16px; font-size: 13px; color: var(--ink-3); text-align: center; }
.recipes-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.recipes-row:last-child { border-bottom: 0; }
.recipes-row.active { background: var(--forest-tint); }
.recipes-main {
  flex: 1; min-width: 0; text-align: left;
  background: transparent; border: 0; cursor: pointer; padding: 2px 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.recipes-main:hover .recipes-name { color: var(--forest); }
.recipes-name {
  font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recipes-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.recipes-acts { display: flex; gap: 6px; flex: none; }
.recipes-act {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; transition: all .16s;
}
.recipes-act:hover { border-color: #D6C6AE; color: var(--ink); }
.recipes-act-danger:hover { border-color: #E0A99A; color: #A4442E; background: var(--clay-tint); }
.recipes-note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }
