/* PantryNote — r6 design system
   Bright paper, dark forest ink, ONE action colour (lime, always with ink text).
   Wide spacing, system fonts only, own SVG mark. States are always named in text;
   colour only repeats what the text already says. */

:root {
  --paper: #FAFBF6;
  --card: #FFFFFF;
  --ink: #14251B;
  --ink-soft: #4A5A50;
  --forest: #1D4A2E;
  --forest-wash: #EAF2E6;
  --action: #C8F169;
  --action-hover: #B4E34A;
  --rule: #DDE4D8;
  --field: #7A887E;
  --review-ink: #8A4B00;
  --review-wash: #FFF3D6;
  --have-ink: #2F5873;
  --have-wash: #E8F0F6;
  --error: #B3261E;
  --error-wash: #FDECEA;
  --disabled-bg: #E6EAE3;
  --focus: #14251B;
  --radius-field: 10px;
  --radius-panel: 16px;
  --radius-pill: 999px;
  --shadow: 0 1px 0 rgba(20, 37, 27, .06), 0 14px 36px -18px rgba(20, 37, 27, .28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:lang(ja) { --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans CJK JP", "Noto Sans JP", system-ui, sans-serif; }
:lang(ko) { --font: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", "Noto Sans KR", system-ui, sans-serif; }
:lang(zh-Hans) { --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
:lang(ja) body, body:lang(ja), :lang(zh-Hans) body, body:lang(zh-Hans) { line-height: 1.75; }

a { color: var(--forest); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--action); color: var(--ink); padding: 10px 14px; border: 2px solid var(--ink); border-radius: var(--radius-field); font-weight: 700;
}
.skip:focus { top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- masthead ---------- */
.masthead { background: var(--card); border-bottom: 1px solid var(--rule); }
.masthead-inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0;
  color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em;
}
.brand-mark { flex: none; display: block; }
.langs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.langs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--ink); text-decoration: none; border-radius: var(--radius-pill); font-size: 0.9375rem;
}
.langs a:hover { background: var(--forest-wash); }
.langs a[aria-current="true"] { background: var(--ink); color: #FFFFFF; font-weight: 700; }

/* ---------- page ---------- */
.main { max-width: 1120px; margin: 0 auto; padding: 32px 16px 56px; }
.main:focus { outline: none; }
h1 { font-size: 1.875rem; line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.02em; font-weight: 800; }
h2 { font-size: 1.3125rem; line-height: 1.3; margin: 36px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 1.0625rem; line-height: 1.35; margin: 0 0 6px; }
:lang(ja) h1, :lang(ko) h1, :lang(zh-Hans) h1 { letter-spacing: 0; line-height: 1.32; }
.lede { font-size: 1.125rem; max-width: 38em; margin: 0 0 24px; color: var(--ink-soft); }
.scope {
  max-width: 44em; margin: 0 0 24px; padding: 12px 16px;
  border-radius: var(--radius-field); background: var(--forest-wash); color: var(--ink);
}
.hint, .muted { color: var(--ink-soft); }
.hint { font-size: 0.9375rem; margin: 4px 0 10px; }
.prose { max-width: 42em; }
.prose li { margin-bottom: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  font: inherit; font-size: 1rem; line-height: 1.3; min-height: 44px; min-width: 44px; padding: 9px 16px;
  border-radius: var(--radius-field); border: 1.5px solid var(--ink); background: var(--card); color: var(--ink);
  cursor: pointer; font-weight: 700;
}
.btn:hover:not(:disabled) { background: var(--forest-wash); }
.btn-primary, .btn-cta { background: var(--action); color: var(--ink); border-color: var(--ink); }
.btn-primary:hover:not(:disabled), .btn-cta:hover { background: var(--action-hover); }
.btn-quiet { border-color: var(--field); }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-half { flex: none; padding: 8px 10px; }
.btn:disabled { background: var(--disabled-bg); border-color: #C3CBC4; color: var(--ink-soft); cursor: not-allowed; }
.btn-cta, .btn-outline { min-height: 52px; padding: 12px 24px; border-radius: var(--radius-pill); font-size: 1.0625rem; border-width: 2px; }
.btn-outline { background: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.actions-inline:empty { display: none; }
.status { margin: 8px 0 0; color: var(--forest); font-weight: 700; }
.status:empty { display: none; }
.status.status-error, .status.status-error:not(:empty) { color: var(--error); }

/* ---------- state labels (text first, colour second) ---------- */
.state {
  display: inline-block; padding: 1px 10px; border-radius: var(--radius-pill); border: 1px solid currentColor;
  font-size: 0.8125rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.state-buy, .state-ok { color: var(--forest); background: var(--forest-wash); }
.state-have { color: var(--have-ink); background: var(--have-wash); }
.state-recheck, .state-review { color: var(--review-ink); background: var(--review-wash); }
.state-error { color: var(--error); background: var(--error-wash); }

/* ======================= home ======================= */
.hero { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); align-items: start; margin-bottom: 8px; }
.hero-title { font-size: clamp(1.75rem, 1.1rem + 2.6vw, 3rem); line-height: 1.12; margin: 0 0 16px; max-width: 18em; }
:lang(ja) .hero-title, :lang(ko) .hero-title, :lang(zh-Hans) .hero-title { line-height: 1.3; }
/* r9: balanced headline; Korean keeps words whole (keep-all only for ko — ja/zh break per
   character as usual; their headline is split into phrase segments (.hl-seg) instead) */
.hero-title, .hero .lede { text-wrap: balance; }
:lang(ko) .hero-title, :lang(ko) .hero .lede, :lang(ko) .pv-title { word-break: keep-all; overflow-wrap: anywhere; }
.hl-seg { display: inline-block; max-width: 100%; }
.hero .lede { margin-bottom: 22px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px 12px; }

.preview {
  margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 20px;
  box-shadow: var(--shadow); padding: 16px 18px 12px; min-width: 0;
}
.pv-title { font-weight: 800; font-size: 0.9375rem; color: var(--ink-soft); margin: 0 0 8px; letter-spacing: 0.01em; }
.pv-stage { padding: 10px 0; border-top: 1px dashed var(--rule); }
.pv-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1rem; }
.pv-buy {
  border: 1.5px solid var(--ink); border-radius: 12px; padding: 10px 14px 6px; margin: 0 0 4px;
  background: var(--card); box-shadow: inset 0 4px 0 var(--action);
}
.pv-buy + .pv-stage { border-top: 0; }
.pv-buy .pv-qty { font-size: 1.25rem; }
.pv-in > summary { cursor: pointer; list-style: none; min-height: 44px; margin: 0; }
.pv-in > summary::-webkit-details-marker { display: none; }
.pv-in > summary::before { content: "+"; width: 1em; color: var(--forest); font-weight: 800; flex: none; }
.pv-in[open] > summary::before { content: "−"; }
.pv-show { color: var(--forest); text-decoration: underline; text-underline-offset: 0.2em; font-size: 0.875rem; }
.pv-in[open] .pv-show { display: none; }
.pv-in .pv-recipes { padding: 2px 0 6px; }
.pv-count { margin-left: auto; font-size: 0.875rem; color: var(--ink-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.pv-recipes { display: grid; gap: 4px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pv-recipe-name { margin: 0; font-size: 0.8125rem; font-weight: 700; color: var(--ink-soft); }
.pv-pasted { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6; }
.pv-pasted li { display: flex; gap: 8px; }
.pv-ln { color: var(--ink-soft); min-width: 1ch; text-align: right; flex: none; }
.pv-reviews, .pv-lines { list-style: none; margin: 0; padding: 0; }
.pv-reviews li {
  margin: 0 0 4px; padding: 4px 10px; border-left: 3px solid var(--review-ink); background: var(--review-wash);
  border-radius: 0 8px 8px 0; font-size: 0.9375rem;
}
.pv-meta { color: var(--ink-soft); font-size: 0.8125rem; }
.pv-lines li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 2px 0; border-bottom: 1px solid var(--rule); }
.pv-lines li:last-child { border-bottom: 0; }
.pv-name { font-weight: 600; }
.pv-qty { font-weight: 800; font-size: 1.125rem; color: var(--forest); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-note { margin: 6px 0 0; font-size: 0.8125rem; color: var(--ink-soft); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.step { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 18px 20px; }
.step p { margin: 0; color: var(--ink-soft); }
.step-n {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-bottom: 10px;
  border-radius: 50%; background: var(--action); color: var(--ink); font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--ink);
}

.tasks { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.task {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; min-height: 44px; height: 100%;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel);
  color: var(--ink); text-decoration: none;
}
.task:hover { border-color: var(--ink); }
.task-name { font-size: 1.125rem; font-weight: 800; color: var(--ink); }
.task-name::after { content: " →"; color: var(--forest); }
.task-desc { color: var(--ink-soft); }
.saved { margin-bottom: 20px; }
.saved h2 { font-size: 1.0625rem; }
.limits { border-top: 1px solid var(--rule); margin-top: 36px; }
.limit-list { margin: 0 0 12px; padding-left: 1.2em; max-width: 46em; color: var(--ink-soft); }
.limit-list li { margin-bottom: 6px; }
.limit-links { margin: 0; }
.limit-links a { display: inline-flex; align-items: center; min-height: 44px; }

.page-root .root-title span { display: block; }
.page-root .root-title span + span { font-size: 1.125rem; font-weight: 600; color: var(--ink-soft); }
.tasks-langs .hint { margin: 6px 4px 0; }

/* ======================= forms (all tools) ======================= */
.workspace { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.calc { max-width: 680px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.group { border-top: 1px solid var(--rule); padding-top: 18px; margin-top: 20px; }
.purpose { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 14px 16px 6px; }
.purpose legend { float: left; width: 100%; margin-bottom: 6px; }
.purpose legend + * { clear: left; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.choice, .check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.choice input, .check input { width: 22px; height: 22px; margin: 0; accent-color: var(--forest); flex: none; }
.gate { margin: 10px 0 0; font-weight: 700; }
.gate:empty { display: none; }
.gate-outside { color: var(--error); }

.field { margin: 0 0 12px; min-width: 0; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
input[type="text"], select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink);
  width: 100%; min-height: 44px; padding: 8px 12px;
  background: var(--card); border: 1.5px solid var(--field); border-radius: var(--radius-field);
}
textarea { font: inherit; font-size: 1rem; }
select { padding-right: 28px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border: 2px solid var(--error); background: var(--error-wash); }
.amount-group { display: flex; gap: 6px; }
.amount-group input { flex: 1 1 auto; min-width: 0; }
.field-error { color: var(--error); font-weight: 700; margin: 4px 0 0; }
.field-error::before { content: "! "; }
.pair { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); }
.ing-row { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); padding: 12px 0 4px; border-bottom: 1px dashed var(--rule); }
.ing-row legend { font-size: 0.9375rem; color: var(--ink-soft); font-weight: 700; }
.btn-remove { justify-self: start; margin-bottom: 10px; }
#remove-retry { margin-top: 8px; }
.error-summary { margin-top: 16px; padding: 10px 14px; border: 2px solid var(--error); border-radius: var(--radius-field); color: var(--error); font-weight: 700; background: var(--error-wash); }
.remember { margin-top: 10px; }
.vm { margin: 16px 0 0; padding: 14px 16px; border: 2px solid var(--error); border-radius: var(--radius-panel); background: var(--card); }
.vm h2 { margin: 0 0 8px; font-size: 1.0625rem; }
.vm-msg { color: var(--error); font-weight: 700; }
select:disabled { background: #F0F2EF; color: var(--ink-soft); }

/* result panel (scale/convert) */
.result {
  background: var(--card); border: 1px solid var(--rule); border-top: 6px solid var(--action);
  border-radius: var(--radius-panel); padding: 18px 20px; min-width: 0; box-shadow: var(--shadow);
}
.result.has-result { border-color: var(--ink); border-top-color: var(--action); }
.result h2 { margin: 0 0 8px; font-size: 1.0625rem; }
.result-figure { margin: 4px 0 8px; line-height: 1.1; }
.result-figure .num { font-size: 2.5rem; font-weight: 800; color: var(--forest); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.result-figure .unit { font-size: 1.25rem; font-weight: 700; }
.result-lead { font-weight: 700; }
.exact { display: block; font-size: 0.9375rem; color: var(--ink-soft); }
.premise { padding-left: 1.1em; margin: 8px 0; }
.premise li { margin-bottom: 4px; }
.premise-line { font-weight: 700; }
.tip { color: var(--ink-soft); font-size: 0.9375rem; }
.result-table, .std-table, .paste-table table { border-collapse: collapse; width: 100%; }
.result-table th, .result-table td, .std-table th, .std-table td, .paste-table th, .paste-table td {
  text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule);
}
.result-table thead th, .std-table thead th, .paste-table thead th { font-size: 0.875rem; color: var(--ink-soft); font-weight: 700; }
.result-table .big { font-size: 1.375rem; font-weight: 800; color: var(--forest); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.std-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.copy-fallback { margin-top: 10px; }
.copy-fallback label { display: block; font-weight: 700; margin-bottom: 4px; }
.copy-fallback textarea { min-height: 7em; }
.source-list { padding-left: 1.1em; }
.source-list li { margin-bottom: 12px; }

/* disclosures */
.disclosure { border: 1px solid var(--rule); border-radius: var(--radius-field); background: var(--card); margin: 12px 0; }
.disclosure > summary {
  cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-weight: 700; list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; display: inline-block; width: 1em; color: var(--forest); font-weight: 800; flex: none; }
.disclosure[open] > summary::before { content: "−"; }
.disclosure-body { padding: 4px 14px 12px; }
.remember .disclosure { margin-top: 16px; }
.readout { margin: 6px 0 0; font-size: 0.9375rem; color: var(--forest); font-weight: 700; font-variant-numeric: tabular-nums; }
.readout:empty { display: none; }

/* convert: from → to */
.relation { display: grid; gap: 4px 16px; grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
.side { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 12px 14px 2px; min-width: 0; }
.side-label { margin: 0 0 4px; font-size: 0.875rem; font-weight: 700; color: var(--ink-soft); }
.relation-arrow { display: flex; align-items: center; justify-content: center; color: var(--forest); font-size: 1.5rem; font-weight: 800; line-height: 1; }
.relation-arrow span { display: inline-block; transform: rotate(90deg); }

/* ======================= shopping workspace ======================= */
.main.page-shopping { max-width: 1440px; }
.ws-title { font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.25rem); }
.ws-scope { margin: 0 0 16px; color: var(--ink-soft); max-width: 52em; }
.about { margin-top: 0; }
.stepnav ol { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.stepnav a {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 10px; min-height: 52px;
  padding: 8px 14px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel);
  color: var(--ink); text-decoration: none;
}
.stepnav a:hover { border-color: var(--ink); }
.stepnav .step-n { grid-row: 1 / 3; margin: 0; width: 30px; height: 30px; font-size: 0.9375rem; }
.step-name { font-weight: 800; }
.step-count { font-size: 0.875rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.shop-status { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-field); background: var(--card); border: 1px solid var(--rule); font-weight: 700; }
.shop-status.has-review { border-color: var(--review-ink); }
.banner { margin: 0 0 12px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: var(--radius-panel); background: var(--card); }
.banner p { margin: 0 0 8px; font-weight: 700; }

.shop-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.draft-cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
.col h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.1875rem; }
.col h2:focus { outline: none; }
.col h2:focus-visible { outline: 3px solid var(--focus); }
.col-n {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--ink); color: #FFFFFF; font-size: 0.875rem; font-weight: 800;
}
#step-list .col-n { background: var(--action); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.editor { min-width: 0; container-type: inline-size; }
.editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.editor-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.review-col, .draft { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 18px; min-width: 0; }
.draft { border-color: var(--ink); box-shadow: var(--shadow); }
.sample-note { margin: 12px 0 0; padding: 8px 12px; border-left: 3px solid var(--field); background: var(--card); color: var(--ink-soft); font-weight: 700; border-radius: 0 8px 8px 0; }

.recipe { border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--card); margin: 12px 0; }
.recipe > summary {
  cursor: pointer; list-style: none; min-height: 48px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 12px 16px; border-bottom: 1px solid transparent;
}
.recipe > summary::-webkit-details-marker { display: none; }
.recipe > summary::before { content: "+"; color: var(--forest); font-weight: 800; width: 1em; }
.recipe[open] > summary::before { content: "−"; }
.recipe[open] > summary { border-bottom-color: var(--rule); }
.r-title { font-weight: 800; font-size: 1.0625rem; }
.r-meta { color: var(--ink-soft); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.r-body { padding: 12px 16px 6px; }
.r-body .disclosure { background: var(--paper); }
.r-body .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.size-item + .size-item { border-top: 1px dashed var(--rule); padding-top: 8px; }

/* paste box */
.paste { border: 2px solid var(--ink); background: var(--card) !important; }
.paste > summary { background: var(--forest-wash); border-radius: 8px 8px 0 0; }
.paste:not([open]) > summary { border-radius: 8px; }
.paste-label { display: block; font-weight: 700; margin: 8px 0 4px; }
.paste textarea { font-family: var(--mono); min-height: 8.5em; line-height: 1.5; }
.paste-counts { margin: 10px 0 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.paste-table { max-height: 20rem; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-field); }
.paste-table:focus-visible { outline-offset: 0; }
.paste-table table { font-size: 0.9375rem; }
.paste-table th, .paste-table td { padding: 6px 8px; }
.paste-table thead th { position: sticky; top: 0; background: var(--card); }
.paste-table td.num { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; width: 3.5em; text-align: right; }
.pl-raw { font-family: var(--mono); white-space: pre-wrap; word-break: break-word; }
.pl-review { background: var(--review-wash); }
.pl-too-long { background: var(--error-wash); }
.pl .state { white-space: normal; }

.s-row {
  display: grid; gap: 0 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  padding: 10px 0 2px; border-top: 1px dashed var(--rule);
}
.s-row .field { margin-bottom: 8px; }
.s-row .field label { font-size: 0.875rem; }
.s-row .row-src { grid-column: 1 / -1; margin: 0 0 4px; font-size: 0.8125rem; color: var(--ink-soft); font-family: var(--mono); }
.s-row .f-name { grid-column: 1; }
.s-row .f-form { grid-column: 2 / 4; }
.s-row .f-qty { grid-column: 1; }
.s-row .f-unit { grid-column: 2; }
.s-row .btn-remove { grid-column: 3; justify-self: end; align-self: end; margin-bottom: 8px; padding: 8px 10px; }
.s-row .f-unitText { grid-column: 1 / -1; }
@container (min-width: 640px) {
  .s-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr) auto; align-items: end; }
  .s-row .f-name, .s-row .f-form, .s-row .f-qty, .s-row .f-unit, .s-row .btn-remove { grid-column: auto; }
  .s-row .f-unitText { grid-column: 1 / 3; }
}

.draft-hint { font-weight: 700; color: var(--review-ink); margin: 0 0 8px; }
.notice { margin: 0 0 8px; padding: 8px 12px; border-left: 3px solid var(--field); background: var(--paper); border-radius: 0 8px 8px 0; }
.notice-error { border-left-color: var(--error); color: var(--error); font-weight: 700; background: var(--error-wash); }
.suggest { margin: 0 0 10px; padding: 10px 12px; border: 1.5px dashed var(--forest); border-radius: var(--radius-field); background: var(--forest-wash); }
.suggest p { margin: 0; font-weight: 600; }
.lines, .reviews, .contrib { list-style: none; padding: 0; margin: 0; }
.line { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.line:last-child { border-bottom: 0; }
.line-main { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; align-items: baseline; }
.line-name { font-weight: 700; min-width: 0; }
.line-form { color: var(--ink-soft); font-weight: 400; }
.line-qty { font-size: 1.375rem; font-weight: 800; color: var(--forest); font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-have .line-qty { color: var(--have-ink); font-size: 1.125rem; }
.line-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.line-sub:empty { display: none; }
.line-actions { margin-left: auto; display: inline-flex; gap: 8px; }
.line-actions .btn { padding: 6px 12px; font-size: 0.9375rem; }
.recheck-text { margin: 6px 0 0; padding: 6px 10px; background: var(--review-wash); color: var(--review-ink); font-weight: 700; border-radius: 8px; }
.have-title { margin: 18px 0 4px; color: var(--have-ink); font-size: 1rem; }
.have-list { border-top: 1px solid var(--rule); }
.badge { display: inline-block; padding: 1px 10px; border-radius: var(--radius-pill); background: var(--paper); border: 1px solid var(--rule); color: var(--ink-soft); font-size: 0.8125rem; font-weight: 700; }
.buy { font-weight: 700; }
.check.small { min-height: 44px; font-size: 0.9375rem; }
.src { margin: 8px 0 0; background: var(--paper); }
.src > summary { font-weight: 700; font-size: 0.9375rem; }
.contrib li { padding: 4px 0; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.contrib + .btn { margin-top: 8px; }
.review-title { font-size: 1rem; margin: 16px 0 6px; color: var(--review-ink); }
.review-title:first-child { margin-top: 0; }
.review { border-left: 4px solid var(--review-ink); background: var(--review-wash); padding: 8px 12px; margin-bottom: 8px; border-radius: 0 var(--radius-field) var(--radius-field) 0; }
.review p { margin: 0 0 4px; }
.review .actions-inline { margin: 4px 0 2px; }
.review .btn { background: var(--card); }
.review.acked { border-left-color: var(--field); background: var(--paper); }
.stale, .stale-review { opacity: .72; }
.save-panel { margin-top: 24px; }
.file-field input[type="file"] { font: inherit; font-size: 1rem; min-height: 44px; max-width: 100%; }
.print-area { display: none; }

/* ---------- footer ---------- */
.foot { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; border-top: 1px solid var(--rule); color: var(--ink-soft); }
.foot-links { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 0 4px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px 0 0; margin-right: 8px; }
.foot-links a[aria-current="page"] { color: var(--ink); font-weight: 800; text-decoration: none; }
.addr { font-size: 0.9375rem; margin: 0; }
.noscript { max-width: 960px; margin: 0 auto; padding: 16px; color: var(--error); font-weight: 700; }

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ing-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: start; }
  .ing-row legend { grid-column: 1 / -1; }
  .btn-remove { margin-top: 1.85rem; }
  .s-row .btn-remove { margin-top: 0; }
  .tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .relation { grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr); }
  .relation-arrow span { transform: none; }
}
@media (max-width: 559.98px) {
  .ing-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ing-row legend, .ing-row .field-name { grid-column: 1 / -1; }
  .ing-row .btn-remove { grid-column: 1 / -1; }
  .main { padding-top: 20px; }
  .hero .lede { font-size: 1rem; margin-bottom: 16px; }
  .pv-recipes { grid-template-columns: minmax(0, 1fr); }
}
/* r9: compact first view on very narrow phones (320–359px) — same content, tighter spacing */
@media (max-width: 359.98px) {
  .main.page-home { padding-top: 14px; }
  .hero { gap: 18px; }
  .hero-title { margin-bottom: 10px; }
  .hero .lede { font-size: 0.9375rem; margin-bottom: 14px; }
  .btn-cta, .btn-outline { padding: 10px 16px; font-size: 1rem; }
  .preview { padding: 12px 12px 8px; }
}
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .tasks:not(.tasks-langs) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 40px; padding-top: 8px; }
  .main.page-home { padding-top: 40px; }
}
@media (min-width: 1024px) {
  h1 { font-size: 2.25rem; }
  .workspace { grid-template-columns: minmax(0, 580px) minmax(0, 1fr); }
  .result { position: sticky; top: 16px; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
  .shop-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .shop-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); }
  .draft-cols { display: contents; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
@media print {
  .masthead, .foot, .actions, .result-actions, .remember { display: none; }
  .main.page-shopping > *:not(#shop-root) { display: none !important; }
  #shop-root > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; white-space: pre-wrap; font-size: 12pt; color: #000; }
}

/* R11: a quiet shelf, precise quantities and a focused shopping surface. */
:root { --paper:#f7f8f2; --forest:#254d3b; --action:#c6e981; --ink:#182d23; }
.main.page-home { max-width:1240px; }
.hero-title { letter-spacing:-.045em; font-weight:780; }
.hero-copy .lede { max-width:34rem; }
.preview { border-color:#dde4d8; box-shadow:0 12px 42px #244d3b0a; }
.home-purchase { padding:8px 0 18px; border-bottom:1px solid #d9e2d2; margin-bottom:14px; }
.shelf-art { display:block; width:100%; height:auto; max-height:106px; margin:0 0 14px; }
.purchase-math { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:8px 0 12px; }
.purchase-math > div { padding:9px 8px; background:#eff3e9; border-radius:12px; min-width:0; }
.purchase-math dt { font-size:.8rem; color:#405746; line-height:1.4; }
.purchase-math dd { margin:5px 0 0; font-size:1.1rem; font-weight:750; font-variant-numeric:tabular-nums; line-height:1.3; overflow-wrap:anywhere; }
.purchase-math .shortfall { background:#d8edb6; }
.purchase-math .shortfall dd { color:#173d29; }
.stock-meter { display:block; width:100%; height:10px; margin:0 0 14px; accent-color:#487349; }
.pack-answer { display:flex; align-items:flex-start; flex-wrap:wrap; gap:8px 14px; padding:10px 0; margin:0; line-height:1.5; }
.pack-answer strong { background:#254d3b; color:#fff; border-radius:9px; padding:5px 10px; font-size:1.15rem; font-variant-numeric:tabular-nums; }
.pack-answer span { flex:1; min-width:140px; font-size:.875rem; }
.demo-link { display:inline-flex; min-height:44px; align-items:center; gap:10px; font-weight:700; }
.feature-grid { display:grid; gap:16px; margin:0 0 32px; }
.feature-card { padding:24px; border:1px solid #dfe6d8; background:#fff; border-radius:20px; }
.feature-index { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; background:#eff4e6; color:#254d3b; border-radius:50%; font-size:.8rem; font-weight:700; }
.feature-card h2 { margin:15px 0 8px; font-size:1.15rem; }
.feature-card p { margin:0; color:#405746; font-size:.95rem; }
.shopping-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin:16px 0; }
.trip-hint { flex:1; min-width:180px; max-width:50rem; margin:0; color:#405746; font-size:.875rem; }
.shopping-toolbar .btn { min-height:48px; }
.collection { background:#fff; border-color:#dce5d7; margin-bottom:20px; }
.collection-save { display:flex; align-items:flex-end; flex-wrap:wrap; gap:12px; }
.collection-save .field { flex:1; min-width:160px; }
.template-list { padding:0; list-style:none; margin:16px 0 0; display:grid; gap:8px; }
.template-list > li { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:12px; border-radius:12px; background:#f1f5eb; }
.template-list .hint { margin:4px 0 0; }
.template-confirm h3 { font-size:1rem; }
.purchase-summary { border-top:1px solid #e1e7dc; margin-top:12px; padding-top:8px; }
.purchase-controls .disclosure-body { padding:12px 0 0; }
.measure-input { display:grid; grid-template-columns:minmax(0,1fr) minmax(72px,.45fr); gap:8px; }
.measure-input input,.measure-input select { min-width:0; width:100%; min-height:44px; font-size:1rem; }
.purchase-check { display:flex; align-items:center; gap:12px; min-height:48px; padding:10px; background:#f0f5e8; border-radius:12px; font-weight:650; cursor:pointer; }
.purchase-check input { width:24px; height:24px; margin:0; flex:none; accent-color:#254d3b; }
.remaining-count { font-size:1.25rem; font-weight:750; margin:8px 0 18px; }
.bought-panel { border:1px solid #dce5d7; border-radius:14px; padding:12px; margin-top:16px; background:#fff; }
.bought-panel summary { min-height:44px; display:flex; align-items:center; cursor:pointer; font-weight:650; }
.purchase-bought .line-main { color:#49624e; }
.trip-complete { border-radius:14px; background:#eaf2dd; padding:18px; }
.shopping-focused .editor,.shopping-focused .review-col,.shopping-focused > .stepnav,.shopping-focused > .about,.shopping-focused > .collection,.shopping-focused > .save-panel { display:none; }
.shopping-focused .shop-grid,.shopping-focused .draft-cols { display:block; }
.shopping-focused .draft { max-width:780px; margin:0 auto; }
.shopping-focused .line { padding:20px; }
.shopping-focused .purchase-math dd { font-size:1.6rem; }
.shopping-focused .line-qty { font-size:1rem; color:#405746; }
.shopping-focused .purchase-check { min-height:56px; }
.line { animation:quantity-arrive 160ms ease-out both; }
.btn,.purchase-check { transition:background-color 160ms ease,box-shadow 160ms ease; }
.btn:hover { box-shadow:0 3px 10px #1d3e2512; }
@keyframes quantity-arrive { from { opacity:.6; transform:translateY(3px); } to { opacity:1; transform:none; } }
@media(min-width:768px) { .feature-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(min-width:960px) { .hero-title { font-size:3.2rem; line-height:1.12; } .hero { gap:52px; } }
@media(max-width:399px) { .purchase-math { gap:5px; } .purchase-math > div { padding:8px 5px; } .purchase-math dd { font-size:1rem; } .shopping-focused .purchase-math dd { font-size:1.3rem; } }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
@media print { .collection,.purchase-controls,.purchase-check,.shopping-toolbar { display:none!important; } }
