/* TableForm — shared styles. Plain, fast, utilitarian. */
:root {
  --ink: #1b1d1e;
  --muted: #5f6b73;
  --line: #e4e7ea;
  --bg: #ffffff;
  --panel: #f6f7f8;
  --accent: #2f7d4f;
  --accent-dark: #27663f;
  --warn: #b4531a;
  --max: 760px;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- header / footer ---- */
.site-head {
  border-bottom: 1px solid var(--line);
}
.site-head .wrap, .site-foot .wrap { display: flex; align-items: center; justify-content: space-between; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.brand { font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: -0.2px; padding: 14px 0; }
.brand span { color: var(--accent); }
.nav a { color: var(--muted); font-size: 15px; margin-left: 18px; }
.nav a:hover { color: var(--ink); }

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 14px;
}
.site-foot .cols { display: flex; flex-wrap: wrap; gap: 32px; }
.site-foot h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); margin: 0 0 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: 3px 0; }
.site-foot .note { margin-top: 20px; max-width: 640px; }

/* ---- page body ---- */
main { max-width: var(--max); margin: 0 auto; padding: 28px 20px 0; }
main.wide { max-width: 1060px; }

h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.4px; margin: 6px 0 10px; }
h2 { font-size: 21px; margin: 34px 0 10px; letter-spacing: -0.2px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
p { margin: 0 0 14px; }

.crumb { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }

/* ---- form card ---- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 22px;
  background: var(--bg);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-weight: 400; color: var(--muted); }

input[type=number], input[type=text], select {
  width: 100%;
  padding: 9px 10px;
  font-size: 16px;
  border: 1px solid #ccd2d6;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }

.segmented { display: inline-flex; border: 1px solid #ccd2d6; border-radius: 5px; overflow: hidden; }
.segmented button {
  border: 0; background: #fff; padding: 8px 14px; font-size: 15px; cursor: pointer; color: var(--muted);
  border-right: 1px solid #ccd2d6;
}
.segmented button:last-child { border-right: 0; }
.segmented button.on { background: var(--accent); color: #fff; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: 11px 22px; font-size: 16px; font-weight: 600; border-radius: 5px; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.block { width: 100%; margin-top: 4px; }
.btn.sec { background: #fff; color: var(--ink); border: 1px solid #ccd2d6; padding: 8px 14px; font-size: 14px; }

/* ---- results ---- */
.result { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: none; }
.result.show { display: block; }
.result .head { background: var(--panel); padding: 16px 20px; border-bottom: 1px solid var(--line); }
.result .big { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.result .big small { font-size: 16px; font-weight: 500; color: var(--muted); }
.result .body { padding: 16px 20px; }

table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }

.macrorow { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.macrobox { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; }
.macrobox .k { font-size: 13px; color: var(--muted); }
.macrobox .v { font-size: 24px; font-weight: 700; }

.callout { background: #fcf6ef; border: 1px solid #efd9c2; color: #6b4320; padding: 12px 14px; border-radius: 5px; font-size: 14px; margin-top: 14px; }
.callout.plain { background: var(--panel); border-color: var(--line); color: var(--muted); }

.faq dt { font-weight: 600; margin-top: 14px; }
.faq dd { margin: 4px 0 0; color: var(--ink); }

.formula { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; font-size: 15px; }
.formula code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }

small.src { color: var(--muted); font-size: 13px; }

/* ---- hub ---- */
.cathead { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 4px; }
.cathead h2 { margin: 0; }
.cathead .tag { font-size: 13px; color: var(--muted); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.tool { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: block; color: var(--ink); }
.tool:hover { border-color: var(--accent); text-decoration: none; }
.tool .t { font-weight: 700; font-size: 17px; }
.tool .d { color: var(--muted); font-size: 14px; margin-top: 3px; }

.rows { }
.rows .row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.rows .row input { margin: 0; }
.iconbtn { border: 1px solid #ccd2d6; background: #fff; border-radius: 5px; height: 38px; cursor: pointer; color: var(--muted); font-size: 18px; }
.iconbtn:hover { color: var(--warn); border-color: var(--warn); }

/* ingredient autocomplete */
.ac { position: relative; }
.ac input { margin: 0; }
.aclist {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid #ccd2d6; border-radius: 5px;
  max-height: 240px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,.08); display: none;
}
.aclist.show { display: block; }
.acitem { padding: 8px 10px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.acitem:last-child { border-bottom: 0; }
.acitem:hover, .acitem.on { background: var(--panel); }
.acitem .meta { color: var(--muted); font-size: 12px; }
.acitem.note { cursor: default; color: var(--muted); font-style: italic; }
.picked-tag { font-size: 12px; color: var(--accent); margin-top: 2px; }

@media (max-width: 620px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  .grid2 { grid-template-columns: 1fr; }
  .tools { grid-template-columns: 1fr; }
  .site-foot .cols { gap: 22px; }
  .rows .row { grid-template-columns: 1fr 96px 34px; }
}
