[hidden] { display: none !important; }
:root {
  --ink: #1c2430;
  --muted: #5b6676;
  --line: #d9dee6;
  --soft: #f4f6f9;
  --accent: #9b2c55;
  --accent-ink: #ffffff;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --ok-bg: #eef6f1;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: #fff; line-height: 1.6; font-size: 17px; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #e7a3bd; outline-offset: 2px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }
header.site { border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -0.01em; }
nav.site a { margin-left: 18px; text-decoration: none; color: var(--muted); font-size: 15px; }
nav.site a:hover { color: var(--ink); }
main { padding: 32px 0 56px; }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 24px; line-height: 1.3; margin: 40px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 19px; margin: 28px 0 8px; }
.lede { font-size: 19px; color: var(--muted); margin: 0 0 24px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; }
.calc fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.calc legend { font-weight: 700; font-size: 18px; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 4px; }
input, select { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #b9c2cf; border-radius: 8px; background: #fff; color: var(--ink); }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.radio-row label { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.radio-row input { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.member { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 10px; align-items: end; padding: 12px; background: var(--soft); border-radius: 8px; margin-bottom: 10px; }
@media (max-width: 620px) { .member { grid-template-columns: 1fr; } }
button { font: inherit; cursor: pointer; border-radius: 8px; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; padding: 12px 20px; font-weight: 700; font-size: 17px; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border: 1px solid #b9c2cf; padding: 9px 14px; color: var(--ink); }
.btn-remove { background: transparent; border: 1px solid #c9cfd8; padding: 9px 12px; color: var(--muted); }
.errors { color: #9b1c1c; background: #fdeeee; border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.errors:empty { display: none; }
#results:empty { display: none; }
#results { margin-top: 28px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.person { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.person .who { color: var(--muted); font-size: 14px; }
.person .amt { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0; }
.person ul { margin: 8px 0 0; padding-left: 18px; font-size: 15px; color: var(--muted); }
.total { margin: 16px 0; padding: 14px 18px; background: var(--ok-bg); border-radius: var(--radius); }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin: 8px 0; font-size: 15px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
details { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
details summary { cursor: pointer; font-weight: 700; }
ol.math li { margin: 6px 0; }
.faq h3 { margin-top: 22px; }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 22px 0 40px; }
footer.site p { margin: 6px 0; }
.small { font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  header.site .wrap { flex-direction: column; align-items: flex-start; gap: 4px; }
  nav.site { display: flex; flex-wrap: wrap; gap: 2px 16px; }
  nav.site a { margin-left: 0; }
  table { display: block; overflow-x: auto; }
  h1 { font-size: 28px; }
}
/* Cross stitch calculators */
.result { margin-top: 24px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.result-box { background: var(--soft); border-radius: var(--radius); padding: 14px 16px; }
.result-box .lbl { font-size: 14px; color: var(--muted); font-weight: 600; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.table-wrap { overflow-x: auto; margin: 12px 0; }
table.data th, table.data td { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data caption { text-align: left; font-size: 14px; color: var(--muted); padding: 0 0 6px; }
tr.current th, tr.current td { background: #f9e7ee; font-weight: 700; }
.errors-inline { color: #9b1c1c; font-size: 15px; min-height: 1em; margin: 8px 0 0; }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
table.colors td { padding: 6px 6px; vertical-align: middle; }
table.colors input { padding: 7px 8px; }
table.colors td:nth-child(2), table.colors td:nth-child(3) { width: 110px; }
table.colors td:nth-child(4) { width: 90px; white-space: nowrap; }
table.colors td:nth-child(5) { width: 36px; }
@media (max-width: 640px) {
  .card { padding: 16px 14px; }
  table.data th, table.data td { white-space: normal; padding: 7px 6px; font-size: 14px; }
  table.data td { white-space: nowrap; }
  table.colors { display: table; font-size: 14px; }
  table.colors th { padding: 6px 4px; font-size: 13px; }
  table.colors td { padding: 5px 3px; }
  table.colors input { padding: 6px 5px; font-size: 15px; }
  table.colors td:nth-child(2) { width: 66px; }
  table.colors td:nth-child(3) { width: 48px; }
  table.colors td:nth-child(4) { width: 64px; }
  table.colors td:nth-child(5) { width: 24px; }
  .big { font-size: 28px; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.colors input[type=number]::-webkit-inner-spin-button, table.colors input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
table.colors input[type=number] { -moz-appearance: textfield; }
