/* Recipes: the list, the editor's sourcing and allergens, uploads to check, and the printed recipe book. */

/* The list */
.to-check { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; text-decoration: none; border-color: var(--est-edge); background: var(--est-bg); }
.recipe-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 16px 0 0; }
.recipe-tools .chips { margin: 0; }
.recipe-tools .small-chips button { min-height: 40px; }
.recipe-search { max-width: 260px; }
.recipe-group h2 { margin: 20px 0 8px; font-size: 17px; }
.tied { white-space: nowrap; }
.tied.all { color: var(--ok-ink); }
.category-list li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 4px; align-items: center; padding: 4px 0; }

/* The editor */
.recipe-meta { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px 20px; margin-top: 12px; }
@media (max-width: 640px) { .recipe-meta { grid-template-columns: 1fr; } }
.sourcing { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 13px; margin-top: 3px; color: var(--ink-soft); }
.sourcing .tied-mark { color: var(--ok-ink); font-weight: 700; }
.sourcing.untied { color: var(--est-ink); }
.trend.up { color: var(--red-pen); }
.trend.down { color: var(--ok-ink); }
.candidates { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.small-pick { min-height: 32px; padding: 2px 8px; font-size: 13px; border-style: dashed; }
.tip-wrap { position: relative; }
.tip { position: absolute; z-index: 20; top: 100%; left: 0; min-width: 320px; max-width: 90vw; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.tip p { margin: 0 0 6px; }
.tip table { border-collapse: collapse; width: 100%; }
.tip td { padding: 3px 6px; border-top: 1px solid var(--edge); vertical-align: top; }
.allergens h3 { margin-bottom: 8px; }
.allergen { display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 14px; border: 1px solid var(--edge); }
.allergen.ok { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-edge); }
.allergen.unchecked { color: var(--est-ink); background: var(--est-bg); border: 1px dashed var(--est-edge); }
.allergen.inherited { opacity: .85; }
.allergens select { width: auto; min-height: 36px; padding: 4px 8px; }
.menu-tag + .menu-tag::before { content: " · "; }
.history .plate-list { margin-bottom: 10px; }
table.impact { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font-size: 15px; }
table.impact td { padding: 6px 4px; border-top: 1px solid var(--edge); }
table.impact tr.same { color: var(--ink-soft); }
.draft-editor { margin: 0 0 16px; padding: 0 0 0 12px; border-left: 3px solid var(--est-edge); }

/* Uploads */
.drop.over { outline: 3px dashed var(--focus); outline-offset: -6px; }
.drop h2 { margin-top: 0; }
.upload-row, .draft-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 6px 12px; align-items: center; padding: 8px 0; }
.upload-row .actions { margin: 0; }
.draft-head { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 0; }
@media (max-width: 640px) { .upload-row, .draft-head { grid-template-columns: 1fr; } }

/* The recipe book: options */
.book-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 16px; align-items: start; }
.book-options .panel { margin: 8px 0; }
.book-options h2 { margin-top: 0; }
.book-options h3 { margin: 12px 0 6px; font-size: 15px; }
.book-options .small-chips { flex-wrap: wrap; }
.book-options .small-chips button { min-height: 38px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; min-height: 36px; }
label.check input { width: 20px; min-height: 20px; }
label.indent, .indent { margin-left: 26px; }
label.inline { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 0; }
label.inline input { width: 90px; }
.book-category summary { list-style: none; cursor: pointer; }
.add-language input { width: 200px; text-align: left; }

/* The recipe book: pages (the same size on screen as on paper) */
.book-preview { display: grid; justify-content: center; gap: 24px; padding: 16px 0 40px; overflow-x: auto; }
.book-count { text-align: center; }
.b-page { background: #fff; color: #111; box-shadow: 0 2px 12px rgba(0, 0, 0, .18); position: relative; overflow: hidden;
  font: var(--b-font, 10.5pt)/1.4 "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif; }
.b-body { overflow: hidden; }
.b-footer { position: absolute; left: 52px; right: 52px; bottom: 26px; text-align: center; font-size: 9pt; color: #666; }
.book-measure { position: absolute; left: -10000px; top: 0; width: var(--b-width); background: #fff; color: #111;
  font: var(--b-font, 10.5pt)/1.4 "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif; }
/* Atoms use padding, never margins, so measured heights add up exactly. */
.b-atom { display: grid; gap: 0 18px; }
.b-side > .b-cell + .b-cell { border-left: 1px solid #ddd; padding-left: 12px; }
.b-k-head, .b-k-cont { padding-top: 4px; border-top: 2px solid #111; }
.b-title { font-size: 1.55em; font-weight: 700; line-height: 1.2; padding-top: 4px; }
.b-k-cont .b-title { font-size: 1.15em; }
.b-k-cont .b-cont { font-weight: 400; color: #666; border: 0; padding: 0; }
.b-sub { color: #444; padding-top: 2px; }
.b-allergens { font-weight: 700; padding-top: 2px; }
.b-ai { color: #8a5300; font-style: italic; padding-top: 2px; }
.b-h { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .85em; padding: 10px 0 3px; color: #333; }
.b-line { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; padding: 2px 0; border-bottom: 1px dotted #ccc; }
.b-amount { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.b-line[dir=rtl] .b-amount { text-align: left; }
.b-ref { color: #555; font-style: italic; }
.b-para { padding: 3px 0; white-space: pre-wrap; }
.b-used { padding: 10px 0 0; font-size: .9em; color: #333; }
.b-gap { height: 22px; }
.b-cover .b-body { display: grid; place-items: center; text-align: center; }
.b-cover-title { font-size: 34pt; font-weight: 700; line-height: 1.15; }
.b-cover-sub { font-size: 14pt; color: #555; padding-top: 10px; }
.b-toc-title { font-size: 20pt; font-weight: 700; padding: 4px 0 16px; }
.b-toc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; padding: 3px 0; }
.b-dots { border-bottom: 1px dotted #999; transform: translateY(-5px); }
.b-index { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }

/* Printing: only the pages, each on its own sheet. */
@media print {
  html.print-book body { background: #fff; }
  html.print-book .sidebar, html.print-book .tabbar, html.print-book .book-controls, html.print-book .book-count,
  html.print-book .queue { display: none !important; }
  html.print-book .shell { display: block; }
  html.print-book main { padding: 0 !important; margin: 0 !important; }
  html.print-book .book-preview { display: block; padding: 0; gap: 0; overflow: visible; }
  html.print-book .b-page { box-shadow: none; break-after: page; page-break-after: always; }
}
.more-options summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.more-options summary h2 { display: inline; margin: 0; }
.more-options summary::before { content: "▸"; }
.more-options[open] summary::before { content: "▾"; }
table.impact th { text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 600; padding: 4px; }

/* What we checked on an auto-generated recipe */
.recipe-checks { display: grid; gap: 4px; margin: 8px 0; }
.recipe-checks ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 2px; }
.recipe-checks li.ok { color: var(--done); }
.back-links { margin: 0 0 8px; }
.back-links .back { display: inline; line-height: normal; min-height: 0; margin: 0; }

/* Ingredient map (pages/ingredient-map.tsx): what we buy, the recipes it goes into, the menu items that use it. */
.map-summary { margin: 12px 0; }
.map-tabs { margin: 8px 0 4px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(60px, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 10px 16px; min-height: 48px; text-decoration: none; color: inherit; }
.map-row:hover { background: color-mix(in srgb, var(--walk-in) 50%, var(--paper)); }
.map-row.item { grid-template-columns: minmax(0, 1.6fr) auto minmax(0, 1fr); }
.map-row .name { font-weight: 600; overflow-wrap: anywhere; }
.map-row .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.map-bar { height: 8px; border-radius: 999px; background: var(--walk-in); overflow: hidden; }
.map-bar span { display: block; height: 100%; background: var(--ink-soft); border-radius: 999px; }
.badge.single { margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 0.8em; font-weight: 500; white-space: nowrap;
  color: var(--est-ink); background: var(--est-bg); border: 1px solid var(--est-edge); }
.map-facts { margin: 4px 0 12px; }
.map-advice { margin: 12px 0; padding: 12px 16px; background: var(--est-bg); border-color: var(--est-edge); }
.map-advice p { margin: 4px 0; }
.map-list li { padding: 8px 0; }
.map-group h3 { margin: 16px 0 6px; }
.map-part { padding: 6px 0; }
.map-part + .map-part { border-top: 1px solid var(--edge); }
.map-part-name { margin: 4px 0; }
.map-recipe { margin: 4px 0 8px; }
.map-recipe-name { margin: 4px 0; }
.map-sub { margin-left: 14px; padding-left: 10px; border-left: 2px solid var(--edge); }
.map-bought { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.map-bubble { text-decoration: none; cursor: pointer; }
.map-bubble .bubble-cost { font-size: 12px; padding-left: 4px; border-left: 1px solid var(--edge); margin-left: 2px; }
.sheet-close { float: right; font-size: 22px; line-height: 1; text-decoration: none; min-height: 0; padding: 0 4px; }
.used-in { white-space: nowrap; }
.used-in.single { color: var(--est-ink); }
@media (max-width: 640px) {
  .map-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; }
  .map-row .map-bar { grid-column: 1 / -1; grid-row: 2; }
  .map-row .map-extra { grid-column: 1 / -1; }
  .map-row.item { grid-template-columns: minmax(0, 1fr); }
}
/* Recipe lines on a phone: the name gets the width, the amount goes underneath (menus.css narrows .line only inside a menu). */
@media (max-width: 560px) {
  .recipe-page .line { grid-template-columns: minmax(0, 1fr) auto; }
  .recipe-page .line-portion { grid-column: 1 / -1; grid-row: 2; justify-items: start; }
}
/* Swap ideas (pages/ingredient-map.tsx): something already bought that would do the same job. */
.swap-note { margin: 6px 0; padding: 8px 10px; border-radius: var(--radius); background: var(--est-bg); border: 1px solid var(--est-edge); color: var(--ink); }
.swap-note button { margin-top: 6px; }
.swap-hint { color: var(--est-ink); font-weight: 600; }
.map-summary p { margin: 4px 0; }
.map-legend .bubble { font-size: 12px; padding: 0 6px; }
.map-advice .actions { margin: 10px 0 4px; }
.map-looking { color: var(--ink-soft); margin: 4px 0; }
.new-category { display: flex; gap: 6px; align-items: center; }
.new-category input { flex: 1; min-width: 0; }
/* Ours until they change it; theirs takes its place */
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: inherit; }
fieldset.plain:disabled input, fieldset.plain:disabled select, fieldset.plain:disabled textarea { background: transparent; color: var(--ink); opacity: 1; }
fieldset.plain:disabled .link.remove, fieldset.plain:disabled .add-ingredient, fieldset.plain:disabled .link.danger { display: none; }
.ours-note { margin: 0; }
.replace-choices { display: grid; gap: 8px; margin: 12px 0; }
.replace-choices button { display: grid; gap: 2px; text-align: left; padding: 12px 14px; }

/* Adding recipes: pasting is its own step under the files; many drafts at once; what saving one does. */
.paste-recipes { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--edge); }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 4px; }
.badge.replaces { margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 0.8em; font-weight: 600;
  color: var(--ok-ink); background: var(--ok-bg); border: 1px solid var(--ok-edge); }

/* Fill in amounts: one recipe at a time, only what's missing. */
.fill-gaps p { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.gap-form label { display: block; margin: 10px 0; }
.gap-lines { display: grid; gap: 8px; }
.gap-line { display: flex !important; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 !important; }
.gap-line .portion-input input { width: 5em; }
.twins .rows { list-style: none; padding: 0; }
