/* "How much for N mg?" calculator on peptide pages (src/calc.js).
   Never wider than its column: the table wraps text, then turns into two-line cards on phones. */
.calc { margin: 18px 0 6px; min-width: 0; max-width: 100%; }
.calc h2 { margin: 0 0 6px; }
.calc h2 #calc-hmg { font-family: var(--mono); }

/* controls */
.calc-f { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 7px 10px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; min-width: 0; }
.calc-amt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.calc-amt > label { font-weight: 600; color: var(--ink); }
.calc-in { display: inline-flex; align-items: center; height: 28px; border: 1px solid var(--line-2); background: var(--bg); border-radius: 2px; }
.calc-in:focus-within { border-color: var(--link); }
.calc-in input { width: 70px; height: 26px; border: 0; background: transparent; color: var(--ink); font: 600 13px var(--mono); text-align: right; padding: 0 4px 0 6px; -moz-appearance: textfield; appearance: textfield; }
.calc-in input::-webkit-outer-spin-button, .calc-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-in input:focus-visible { outline: 0; }
.calc-in .u, .calc-q .u { font: 12px var(--mono); color: var(--ink-3); padding-right: 6px; }
.calc-q { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0; }
.calc-q button { font: 500 12px var(--mono); color: var(--ink-2); background: var(--bg); border: 1px solid var(--line-2); border-left-width: 0; height: 28px; min-width: 38px; padding: 0 8px; cursor: pointer; }
.calc-q button:first-child { border-left-width: 1px; border-radius: 2px 0 0 2px; }
.calc-q button:nth-last-child(2) { border-radius: 0 2px 2px 0; margin-right: 5px; }
.calc-q button:hover { color: var(--ink); background: var(--hover); }
.calc-q button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.calc-ck { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); cursor: pointer; }
.calc-ck input { margin: 0; width: 14px; height: 14px; }
.calc-sel { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); min-width: 0; }
.calc-sel select { height: 28px; max-width: 190px; min-width: 0; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font: 12px var(--sans); padding: 0 4px; border-radius: 2px; }

/* summary line (aria-live) */
.calc-sum { margin: 8px 0 6px; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.calc-sum b { font-family: var(--mono); font-weight: 600; }

/* results table */
.calc-t { width: 100%; table-layout: fixed; border-collapse: collapse; font-variant-numeric: tabular-nums; border: 1px solid var(--line); }
.calc-t col.c-rk { width: 30px; }
.calc-t col.c-st { width: 25%; }
.calc-t col.c-tot { width: 92px; }
.calc-t col.c-pmg { width: 84px; }
.calc-t col.c-buy { width: auto; }
.calc-t col.c-sh { width: 22%; }
.calc-t col.c-lk { width: 72px; }
.calc-t th { background: var(--panel); font: 600 11px/1.3 var(--sans); color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line-2); vertical-align: bottom; }
.calc-t td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; min-width: 0; }
.calc-t tbody tr:last-child td { border-bottom: 0; }
.calc-t tbody tr:hover { background: var(--hover); }
.calc-t .calc-rk { color: var(--ink-3); font: 11px/18px var(--mono); text-align: right; padding-right: 4px; }
.calc-t th.calc-rk { font: 600 11px/1.3 var(--sans); }
.calc-st { font-weight: 500; }
.calc-st .score { vertical-align: 0; margin-left: 2px; }
.calc-st .tag { vertical-align: 0; }
.calc-bd { display: block; font: 12px/18px var(--mono); color: var(--ink); }
.calc-pk { white-space: nowrap; }
.calc-plus { color: var(--ink-3); }
.calc-mg { display: block; font-size: 11px; color: var(--ink-3); line-height: 1.35; }
.calc-t .calc-tot, .calc-t .calc-pmg { text-align: right; }
.calc-t td.calc-buy, .calc-t th.calc-buyh { padding-left: 18px; }
.calc-t td.calc-tot { font: 600 13px/18px var(--mono); white-space: nowrap; }
.calc-t td.calc-pmg { font: 12px/18px var(--mono); color: var(--ink-2); white-space: nowrap; }
.calc-u { color: var(--ink-3); font-size: 11px; }
.calc-sh { font-size: 12px; line-height: 18px; color: var(--ink-2); }
.calc-sh .cur { font-family: var(--mono); font-size: 11px; }
.calc-free { color: var(--good); font-weight: 500; }
.calc-extra { color: var(--ink-2); }
.calc-rg { color: var(--ink-3); font-size: 11px; }
.calc-days { display: block; font-size: 11px; line-height: 1.35; color: var(--ink-3); }
/* "with shipping" mode: stores with no published shipping cost follow under their own heading row */
.calc-t tr.calc-div th { background: var(--panel); font: 500 11px/1.4 var(--sans); color: var(--ink-2); text-transform: none; letter-spacing: 0; text-align: left; padding: 4px 8px; border-top: 2px solid var(--line-2); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.calc-t tbody tr.calc-div:hover { background: transparent; }
.calc-lk { font-size: 12px; line-height: 18px; white-space: nowrap; text-align: right; }
.calc-t th:last-child { text-align: right; }

@media (max-width: 900px) {
  .calc-t col.c-st { width: 25%; }
  .calc-t col.c-sh { width: 19%; }
  .calc-t col.c-tot { width: 82px; }
  .calc-t col.c-pmg { width: 74px; }
  .calc-t col.c-lk { width: 62px; }
  .calc-t td.calc-buy, .calc-t th.calc-buyh { padding-left: 12px; }
  .calc-f { gap: 8px 14px; }
}

/* Narrow screens: each store becomes a card. Store and total on the first line; what to buy,
   per mg, shipping and the listing link flow under it (one more line when there is room). */
@media (max-width: 760px) {
  .calc-t, .calc-t tbody { display: block; }
  .calc-t colgroup { display: none; }
  .calc-t thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .calc-t tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 1px; padding: 7px 10px 7px 32px; border-bottom: 1px solid var(--line); }
  .calc-t tbody tr:last-child { border-bottom: 0; }
  .calc-t tr::after { content: ""; order: 3; flex: 0 0 100%; height: 0; }
  .calc-t td { display: block; border: 0; padding: 0; }
  .calc-t td.calc-rk { position: absolute; left: 6px; top: 7px; width: 18px; padding: 0; line-height: 19px; }
  .calc-t td.calc-st { order: 1; flex: 1 1 0; min-width: 0; font-size: 13px; }
  .calc-t td.calc-tot { order: 2; flex: 0 0 auto; padding-left: 10px; font-size: 14px; }
  .calc-t td.calc-buy { order: 4; padding-left: 0; margin-right: 14px; }
  .calc-t td.calc-pmg { order: 5; margin-right: 14px; text-align: left; }
  .calc-t td.calc-sh { order: 6; min-width: 0; margin-right: 14px; }
  .calc-t td.calc-lk { order: 7; margin-left: auto; }
  .calc-bd, .calc-mg { display: inline; }
  .calc-mg::before { content: "\00a0\00B7\00a0"; }
  .calc-days { display: inline; }
  .calc-days::before { content: "\00a0\00B7\00a0"; }
  .calc-t tr.calc-div { display: block; padding: 0; border-bottom: 0; }
  .calc-t tr.calc-div::after { content: none; }
  .calc-t tr.calc-div th { display: block; padding: 5px 10px; }
}
@media (max-width: 620px) {
  .calc-f { padding: 8px 10px; }
  .calc-amt { width: 100%; }
  .calc-sel select { max-width: 150px; }
}

.calc-t td.calc-st .score { white-space: nowrap; }
.calc-t .calc-nm { display: inline; overflow-wrap: anywhere; }
