:root {
  --ink: #16212b; --muted: #5b6b78; --line: #dde4ea; --bg: #f6f8fa; --card: #fff;
  --brand: #0f766e; --brand-dark: #0b5650; --brand-soft: #e6f4f2; --accent: #f59e0b;
  --radius: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.6 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand-dark); }
a:hover { color: var(--brand); }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.2; margin: .4em 0 .3em; letter-spacing: -.01em; }
h1 .sub { color: var(--muted); font-weight: 500; font-size: .6em; white-space: nowrap; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 10px; top: 10px; background: #fff; padding: 8px; z-index: 9; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: .85rem; color: var(--muted); }
.muted { color: var(--muted); font-size: .85em; }
.lede { font-size: 1.12rem; color: #33434f; max-width: 760px; }

/* header / footer */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 1.25rem; font-weight: 600; }
.brand b { color: var(--brand); }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 1.2rem; }
.site-head ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.site-head nav a { display: block; padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.site-head nav a:hover, .site-head nav a[aria-current] { background: var(--brand-soft); color: var(--brand-dark); }
.site-foot { margin-top: 60px; padding: 30px 0; background: #11202a; color: #c9d4dc; }
.site-foot a { color: #fff; } .site-foot .small { color: #9fb0bc; }
.crumbs { font-size: .85rem; color: var(--muted); margin-top: 18px; }
.crumbs a { color: var(--muted); }

/* converter */
.conv { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0 8px; box-shadow: 0 2px 10px rgba(16, 40, 60, .05); }
.conv-row { display: grid; grid-template-columns: 1fr 1.4fr auto 1.4fr; gap: 12px; align-items: end; }
.conv.cook .conv-row:first-child { grid-template-columns: 1fr; margin-bottom: 12px; }
.fld span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.fld input, .fld select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c8d2da; border-radius: 9px; background: #fff; color: var(--ink); min-height: 46px; }
.fld input { font-size: 1.2rem; font-weight: 600; }
.fld input:focus, .fld select:focus { outline: 3px solid rgba(15, 118, 110, .25); border-color: var(--brand); }
.swap { min-height: 46px; width: 46px; border: 1px solid #c8d2da; border-radius: 9px; background: var(--bg); font-size: 1.3rem; cursor: pointer; color: var(--brand-dark); }
.swap:hover { background: var(--brand-soft); }
.c-out { display: block; margin-top: 16px; padding: 14px 16px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); font-size: clamp(1.15rem, 3vw, 1.55rem); font-weight: 700; word-break: break-word; }
.c-out.err { background: #fff4e5; color: #8a4b00; font-size: 1rem; font-weight: 600; }
.c-formula { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }
.c-actions { margin-top: 10px; }
.copy, .btn { font: inherit; font-size: .95rem; padding: 8px 16px; border-radius: 9px; border: 0; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
.copy { background: transparent; color: var(--brand-dark); border: 1px solid var(--line); padding: 6px 12px; font-size: .85rem; }
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--brand); }

/* layout */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
.cols > aside { position: sticky; top: 80px; }
.cols > aside h2 { font-size: 1.05rem; margin-top: 1.4em; }
table { border-collapse: collapse; width: 100%; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 700; padding: 0 0 8px; font-size: 1.05rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #eef2f5; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: #3d4e5b; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: #fafbfc; }
.all-units { margin-top: 26px; }
.all-units td:last-child { font-weight: 600; }
.formula-box { font-size: 1.2rem; font-weight: 700; background: var(--card); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 0 9px 9px 0; }
ul.links { list-style: none; padding: 0; margin: 0; }
ul.links li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
ul.links a { text-decoration: none; } ul.links a:hover { text-decoration: underline; }
.tools, .shop { background: #fffaf0; border: 1px solid #f5dfb3; border-radius: var(--radius); padding: 4px 16px 12px; margin-top: 18px; }
.tools h2, .shop h2 { margin-top: .8em !important; }
.tools ul { list-style: none; padding: 0; margin: 0; } .tools li { padding: 4px 0; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; margin: 8px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: .6em 0 .2em; }

/* home */
.hero { text-align: center; padding: 40px 0 10px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hero .lede { margin: 0 auto; }
.search { position: relative; max-width: 620px; margin: 24px auto 10px; }
.search input { width: 100%; font: inherit; font-size: 1.15rem; padding: 14px 18px; border-radius: 30px; border: 2px solid var(--brand); outline: none; box-shadow: 0 4px 16px rgba(15, 118, 110, .12); }
.q-results { position: absolute; left: 0; right: 0; top: 100%; margin: 6px 0 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); z-index: 4; text-align: left; }
.q-results a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.q-results a:hover, .q-results a.on { background: var(--brand-soft); }
.q-results .none { padding: 8px 12px; color: var(--muted); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.chip { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-decoration: none; font-weight: 700; color: var(--ink); }
.chip small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.chip:hover { border-color: var(--brand); }
.kitchen-band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; background: var(--brand-soft); border-radius: 16px; padding: 10px 28px 24px; margin: 40px 0; }
.cols2 { columns: 2; margin-top: 24px !important; } .cols2 li { break-inside: avoid; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 30px; }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 24px; }
.print-only { display: none; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
code { background: #eef2f5; padding: 1px 5px; border-radius: 4px; }

/* widget */
.wb-row { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 14px; }
.widget-builder textarea { width: 100%; font: 13px/1.5 ui-monospace, Consolas, monospace; padding: 10px; border: 1px solid #c8d2da; border-radius: 9px; background: #f8fafb; resize: vertical; }
.wb-preview { background: repeating-linear-gradient(45deg, #f1f4f6, #f1f4f6 10px, #f8fafb 10px, #f8fafb 20px); border: 1px dashed var(--line); border-radius: var(--radius); padding: 20px; }
.widget-band { margin-top: 36px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
body.embed { background: transparent; font-size: 15px; margin: 0; padding: 2px; }
body.embed .conv { margin: 0; padding: 14px; box-shadow: none; }
body.embed .conv-row { grid-template-columns: 1fr auto 1fr; gap: 8px; }
body.embed .conv-row > .fld:first-child { grid-column: 1 / -1; }
body.embed .conv.cook .conv-row:first-child { margin-bottom: 8px; }
body.embed .fld input, body.embed .fld select { min-height: 40px; padding: 7px 10px; }
body.embed .fld input { font-size: 1.05rem; }
body.embed .swap { min-height: 40px; width: 40px; }
body.embed .c-out { margin-top: 10px; padding: 10px 12px; font-size: 1.1rem; }
body.embed .c-formula { font-size: .8rem; }
body.embed .c-actions { display: none; }
.embed-foot { margin: 6px 4px 0; font-size: 12px; color: var(--muted); }
.embed-foot a { color: var(--muted); }

@media (max-width: 860px) {
  .cols, .kitchen-band { grid-template-columns: 1fr; }
  .cols > aside { position: static; }
  .conv-row, .wb-row { grid-template-columns: 1fr auto 1fr; }
  .wb-row { grid-template-columns: 1fr; }
  .conv-row > .fld:first-child { grid-column: 1 / -1; }
  .site-head { position: static; }
  .sheet-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .conv { padding: 14px; }
  .conv-row { grid-template-columns: 1fr; }
  .swap { width: 100%; }
  .cols2 { columns: 1; }
}
@media print {
  .site-head, .site-foot, .noprint, .crumbs { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .print-only { display: block; margin: 0 0 10px; }
  .sheet-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  th, td { padding: 4px 8px; }
  table { border: 1px solid #999; }
}
