/* System fonts and local assets keep the calculator self-contained. */
:root {
  color-scheme: light;
  --paper: #f1f3f5;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #505d68;
  --line: #ccd2d8;
  --boundary: #7b8791;
  --primary: #b52b35;
  --primary-hover: #95212b;
  --focus: #235d9f;
  --result: #e5eaf0;
  --positive: #28583d;
  --caution: #765019;
  --error: #97232c;
  --error-surface: #fff0f1;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; accent-color: var(--primary); }
button { cursor: pointer; }
button:disabled { cursor: default; color: var(--muted); background: #e2e6ea; border-color: var(--line); }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { max-width: 1120px; margin: auto; padding: 0 32px; }
.site-header { min-height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 26px; letter-spacing: -1px; font-weight: 800; min-height: 44px; }
.brand img { width: 30px; height: 30px; }
.brand-light { font-weight: 450; }
.brand-dot { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.connection { font-size: 13px; color: var(--muted); }
.intro { padding: 26px 0 24px; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.7px; margin: 0; font-weight: 700; }
.target-note { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(310px, 1fr); gap: 32px; align-items: start; }
.main-column { display: grid; gap: 24px; min-width: 0; }
.card { padding: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h2 { font-size: 18px; margin: 0; font-weight: 700; }
h3 { font-size: 14px; margin: 0 0 12px; font-weight: 650; }
.unit-switch { margin: 0; padding: 2px; border: 1px solid var(--boundary); border-radius: var(--radius); display: flex; background: var(--surface); }
.unit-switch label { position: relative; }
.unit-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.unit-switch span { display: grid; place-items: center; width: 44px; min-height: 44px; border-radius: 4px; font-size: 14px; cursor: pointer; }
.unit-switch input:checked + span { background: var(--ink); color: var(--surface); font-weight: 700; }
.unit-switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.field-label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; }
.field-label .muted { font-weight: 400; margin-left: 5px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; line-height: 1.5; margin: 8px 0 0; }
input, select { background: var(--surface); border: 1px solid var(--boundary); border-radius: var(--radius); color: var(--ink); padding: 10px 12px; min-height: 44px; width: 100%; }
input::placeholder { color: var(--muted); }
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.target-field { display: flex; align-items: center; gap: 12px; border: 1px solid var(--boundary); border-radius: var(--radius); background: var(--surface); padding: 0 16px; }
.target-field:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.target-field input { font-size: clamp(44px, 5vw, 60px); line-height: 1.3; font-weight: 600; letter-spacing: -2px; padding: 6px 0; border: 0; min-width: 0; background: transparent; outline: none; }
.target-field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.target-field .unit-label { font-size: 23px; color: var(--muted); }
.target-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.bar-summary { font-size: 13px; color: var(--muted); margin: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius); font-size: 14px; font-weight: 600; }
.primary { background: var(--primary); color: var(--surface); }
.primary:hover { background: var(--primary-hover); }
.dark { background: var(--ink); color: var(--surface); }
.quiet { background: transparent; border-color: var(--boundary); color: var(--ink); }
.quiet:hover { background: #e2e6ea; }
.text { color: var(--muted); background: transparent; padding-left: 8px; padding-right: 8px; }
.text:hover:not(:disabled) { color: var(--error); background: var(--error-surface); }
.small { padding: 8px 12px; }
.full { width: 100%; }
.tag { font-size: 13px; color: var(--muted); }
.result-card { background: var(--result); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.load-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.result-label { margin: 0 0 2px; color: var(--muted); font-size: 13px; }
.achieved { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(42px, 5vw, 60px); line-height: 1.2; letter-spacing: -2px; margin: 0; font-weight: 700; }
.achieved .unit-label { font-size: 20px; font-weight: 400; letter-spacing: 0; }
.load-meta { text-align: right; font-size: 13px; }
.load-meta p { margin: 6px 0 0; color: var(--muted); }
.match { color: var(--positive); font-size: 13px; font-weight: 700; }
.match.approximate { color: var(--caution); }
.bar-visual { display: flex; align-items: center; justify-content: center; min-height: 150px; margin: 8px 0 0; position: relative; overflow: hidden; gap: 5px; }
.bar-visual::before { content: ''; position: absolute; height: 12px; width: 94%; background: var(--boundary); border-radius: 2px; }
.bar-collar { height: 49px; width: 15px; flex: 0 0 15px; background: var(--muted); border-radius: 2px; z-index: 1; margin-right: 8px; }
.plate-graphic { z-index: 1; width: 46px; flex: 0 1 46px; min-width: 26px; height: var(--height); border-radius: 4px; background: var(--ink); color: var(--surface); display: flex; justify-content: center; align-items: center; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.plate-overflow { z-index: 1; background: var(--ink); color: var(--surface); border-radius: 4px; padding: 8px; font-size: 13px; }
.visual-caption { font-size: 13px; text-align: center; color: var(--muted); margin: 0 0 16px; }
.plate-list { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 0 0 20px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; }
.transition { border-top: 1px solid var(--boundary); padding-top: 16px; }
.transition h3 { font-size: 13px; margin-bottom: 8px; }
.transition p { font-size: 14px; margin: 6px 0; line-height: 1.5; }
.transition .add { color: var(--positive); }
.transition .remove { color: var(--error); }
.empty-state { padding: 8px 0; }
.empty-state p { font-size: 14px; color: var(--muted); margin: 0; }
.warmup-card { border-top: 1px solid var(--line); padding-top: 24px; }
.warmup-controls { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 20px; }
.warmup-controls .hint { margin: 17px 0 0; }
.warmup-list { list-style: none; padding: 0; margin: 20px 0 12px; }
.warmup-row { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 14px 0; }
.warmup-percent { font-size: 13px; color: var(--muted); width: 38px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.warmup-info { flex: 1; min-width: 0; }
.warmup-info strong { font-family: var(--mono); font-size: 18px; }
.warmup-info p { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 4px 0 0; }
.warmup-placeholder { padding-top: 20px; font-size: 14px; }
.equipment-column { border-left: 1px solid var(--line); padding-left: 24px; }
.equipment-card .section-heading { margin-bottom: 0; }
.equipment-intro { margin: 6px 0 20px; }
.bar-label { margin-top: 14px; }
.inventory-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.inventory-heading h3 { margin-bottom: 0; }
.inventory-labels, .inventory-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) 72px; gap: 8px; }
.inventory-labels { color: var(--muted); font-size: 13px; margin: 14px 0 6px; }
.inventory-row { margin-bottom: 8px; }
.inventory-row input { min-width: 0; padding: 8px; font-size: 16px; }
.inventory-row button { padding: 0 4px; font-size: 13px; }
.limits { margin-bottom: 24px; }
.preset-section { border-top: 1px solid var(--line); padding-top: 24px; }
.save-preset { display: flex; gap: 8px; margin-bottom: 18px; }
.save-preset input { min-width: 0; }
.save-preset .button { padding: 10px 13px; }
.preset-actions { display: flex; justify-content: space-between; margin-top: 10px; gap: 8px; }
#preset-status:empty { display: none; }
#reset-equipment { margin-top: 16px; font-size: 13px; gap: 3px; }
.unit-note { border-top: 1px solid var(--line); padding-top: 16px; }
footer { border-top: 1px solid var(--line); margin-top: 32px; padding: 20px 0 28px; font-size: 13px; color: var(--muted); }
.error, .storage-warning { background: var(--error-surface); border: 1px solid var(--error); border-radius: var(--radius); color: var(--error); padding: 12px; font-size: 14px; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: absolute; top: -80px; left: 20px; z-index: 10; background: var(--ink); color: var(--surface); padding: 15px; }
.skip-link:focus { top: 10px; }
dialog { max-width: min(480px, calc(100% - 32px)); border: 1px solid var(--boundary); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 24px; }
dialog::backdrop { background: #172026c0; }
.dialog-heading { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
dialog p { font-size: 14px; line-height: 1.6; }
@media (max-width: 760px) {
  .shell { padding: 0 20px; max-width: 600px; }
  .site-header { min-height: 64px; }
  .brand { font-size: 24px; }
  .connection { display: none; }
  .intro { padding: 12px 0; }
  h1 { font-size: 26px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .main-column { gap: 20px; }
  .section-heading { margin-bottom: 12px; }
  .target-field input { font-size: 48px; }
  .result-card { padding: 20px; }
  .equipment-column { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .target-bottom { gap: 12px; }
  .button { padding: 10px 12px; }
  .bar-summary { max-width: 130px; }
  .warmup-controls { grid-template-columns: 1fr; gap: 0; }
  .warmup-controls .hint { margin-top: 8px; }
  .warmup-row { flex-wrap: wrap; }
  .warmup-row .button { margin-left: auto; }
  input, select { font-size: 16px; }
}
@media (max-width: 380px) {
  .shell { padding: 0 16px; }
  .result-card { padding: 16px; }
  .load-summary { flex-wrap: wrap; }
  .load-meta { text-align: left; }
  .target-bottom { align-items: stretch; flex-direction: column; }
  .bar-summary { max-width: none; }
}
