.weight-tool {
  --wt-red: #de211b;
  --wt-red-dark: #b91c17;
  --wt-ink: #18252d;
  --wt-muted: #56616a;
  --wt-line: #dddeda;
  --wt-soft: #f5f4f1;
  color: var(--wt-ink);
  min-width: 0;
}
.weight-tool *, .weight-tool *::before, .weight-tool *::after { box-sizing: border-box; }
.weight-tool [hidden] { display: none !important; }
.weight-tool h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; }
.weight-tool h3 { font-size: 1.2rem; line-height: 1.35; }
.weight-tool p, .weight-tool dd, .weight-tool dt, .weight-tool a, .weight-tool code { overflow-wrap: anywhere; }
.weight-tool a { color: var(--wt-red-dark); }
.wt-intro { max-width: 52rem; margin-bottom: 1.6rem; }
.wt-intro p { color: var(--wt-muted); }
.wt-note { margin-bottom: 2rem; padding: 1.2rem 1.4rem; border-inline-start: 4px solid var(--wt-red); background: #fff1ee; }
.wt-note p { margin: .45rem 0 0; }
.wt-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.wt-section-legend { width: 100%; margin-bottom: 1.25rem; font-size: 1.4rem; font-weight: 700; }
.wt-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.5rem; margin-bottom: 1.5rem; }
.wt-field { min-width: 0; }
.wt-field label, .wt-copy-fallback > label { display: block; margin-bottom: .5rem; font-size: .9375rem; font-weight: 650; line-height: 1.5; }
.weight-tool input, .weight-tool select, .weight-tool textarea { display: block; width: 100%; min-width: 0; min-height: 3rem; padding: .75rem .8rem; border: 1px solid #969fa4; border-radius: .3rem; background-color: white; color: var(--wt-ink); font: inherit; font-size: 1rem; line-height: 1.5; }
.weight-tool input[aria-invalid="true"], .weight-tool select[aria-invalid="true"] { border: 2px solid var(--wt-red-dark); }
.weight-tool textarea { resize: vertical; }
.wt-help { display: block; margin: .55rem 0 0; color: var(--wt-muted); font-size: .875rem; line-height: 1.6; }
.wt-row-list { display: grid; gap: 1.5rem; }
.wt-box-row { min-width: 0; margin: 0; padding: 1.3rem; border: 1px solid var(--wt-line); border-radius: .5rem; background: white; }
.wt-box-row legend { padding: 0 .5rem; font-size: 1.1rem; font-weight: 700; }
.wt-row-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.wt-row-heading p { max-width: 42rem; margin: .3rem 0 0; color: var(--wt-muted); font-size: .9rem; }
.wt-measurements { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.wt-row-actions, .wt-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.wt-row-actions .wt-help { margin: 0; }
.wt-button { display: inline-flex; min-height: 2.8rem; align-items: center; justify-content: center; padding: .7rem 1rem; border: 1px solid transparent; border-radius: .3rem; color: var(--wt-ink); background: white; font: inherit; font-size: .9375rem; font-weight: 650; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; }
.weight-tool .wt-button-primary { border-color: var(--wt-red); background: var(--wt-red); color: white; }
.weight-tool .wt-button-primary:hover { border-color: #a01915; background: #a01915; color: white; }
.weight-tool .wt-button-secondary { border-color: #8f989d; color: var(--wt-ink); }
.weight-tool .wt-button-secondary:hover { border-color: var(--wt-ink); background: var(--wt-soft); color: var(--wt-ink); }
.weight-tool .wt-button-quiet { padding-inline: .7rem; border-color: var(--wt-line); color: var(--wt-red-dark); }
.weight-tool .wt-button-quiet:hover { background: var(--wt-soft); }
.weight-tool .wt-button:disabled { cursor: not-allowed; opacity: .55; }
.weight-tool :focus-visible { outline: 3px solid var(--wt-red); outline-offset: 4px; }
.wt-limits { margin-top: 1.25rem; font-size: .875rem; }
.wt-limits summary { width: fit-content; max-width: 100%; cursor: pointer; color: var(--wt-red-dark); text-decoration: underline; text-underline-offset: .2rem; }
.wt-limits p { max-width: 55rem; margin: .8rem 0 0; color: var(--wt-muted); }
.wt-field-error { display: block; margin-top: .5rem; color: var(--wt-red-dark); font-size: .875rem; font-weight: 600; line-height: 1.5; }
.wt-errors { margin-top: 1.5rem; padding: 1.1rem 1.3rem; border: 2px solid var(--wt-red-dark); border-radius: .3rem; background: #fff6f3; }
.wt-errors h3 { margin: 0 0 .7rem; }
.wt-errors ul { margin: 0; padding-inline-start: 1.25rem; }
.wt-status { margin: 1rem 0; color: var(--wt-red-dark); font-size: .9375rem; line-height: 1.6; }
.wt-status:empty { margin: 0; }
.wt-results { margin-top: 2rem; padding: 1.7rem; border: 1px solid #cda49d; border-radius: .5rem; background: var(--wt-soft); scroll-margin-top: 7rem; }
.wt-results > h2 { margin-top: 0; }
.wt-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; margin: 1.5rem 0 2rem; }
.wt-totals > div { min-width: 0; padding: 1rem; border: 1px solid var(--wt-line); border-radius: .3rem; background: white; }
.wt-totals dt { margin-bottom: .7rem; font-size: .875rem; line-height: 1.5; }
.wt-totals dd { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.25; }
.wt-totals .wt-total-reference { border-color: #c99389; background: #fff1ee; }
.wt-breakdown { display: grid; gap: .9rem; margin: 0; padding: 0; list-style: none; }
.wt-breakdown li { margin: 0; padding: 1rem; border: 1px solid var(--wt-line); border-radius: .3rem; background: white; }
.wt-breakdown h4 { margin: 0 0 .5rem; font-size: 1rem; }
.wt-breakdown p { margin: .35rem 0 0; color: var(--wt-muted); font-size: .9375rem; }
.wt-copy-fallback { margin-top: 1.3rem; }
.wt-copy-fallback textarea { margin-bottom: .8rem; }
.wt-explanation { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--wt-line); }
.wt-explanation dl { margin: 1.25rem 0; }
.wt-explanation dl > div { margin-bottom: 1.2rem; }
.wt-explanation dt { margin-bottom: .35rem; font-weight: 700; }
.wt-explanation dd { margin: 0; color: var(--wt-muted); }
.wt-explanation code { color: var(--wt-ink); white-space: normal; }
.wt-next { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 2rem; }
.wt-next > p { flex-basis: 100%; margin: 0; }
.weight-tool select { padding-inline-end: 2.6rem; }
.weight-tool input[type="number"], .weight-tool code { direction: ltr; unicode-bidi: isolate; }
.wt-copy-fallback textarea { text-align: start; unicode-bidi: plaintext; }
html[dir="rtl"] .weight-tool select { background-position: left 1rem center; }
@media (max-width: 70rem) { .wt-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 50rem) {
  .wt-settings { grid-template-columns: minmax(0, 1fr); }
  .wt-measurements { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wt-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wt-results { padding: 1.25rem; }
}
@media (max-width: 25rem) {
  .wt-note, .wt-box-row, .wt-results { padding: 1rem; }
  .wt-measurements, .wt-totals { grid-template-columns: minmax(0, 1fr); }
  .wt-row-heading { flex-direction: column; gap: .65rem; }
  .wt-form-actions > .wt-button, .wt-next > .wt-button { width: 100%; }
}
@media print {
  .wt-form, .wt-form-actions, .wt-copy-fallback, .wt-next, .wt-errors, .wt-status { display: none !important; }
  .wt-results { border-color: #777; background: white; }
}
