@font-face {
  font-family: 'Inter Tight';
  src: url('assets/inter-tight-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --ink: #202c32;
  --muted: #56636a;
  --line: #d5dcde;
  --teal: #205e59;
  --dark-teal: #174843;
  --surface: #fff;
  --page: #f4f5f4;
  --warn: #895507;
  --over: #a53026;
  --inset: clamp(16px, 1.6vw, 25px);
  --gutter: clamp(16px, 3.7vw, 58px);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  color: var(--ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
button, input, select { color: inherit; font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { opacity: .54; cursor: default; }
button, input, select { touch-action: manipulation; }
:where(button, select, input, a, summary):focus-visible {
  outline: 2px solid #167a80;
  outline-offset: 3px;
}
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.7rem, 2.4vw, 2.15rem); font-weight: 640; letter-spacing: -.025em; line-height: 1.12; }
h2 { font-size: 1.12rem; font-weight: 635; letter-spacing: -.012em; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 620; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 5px; left: 5px; padding: 8px; background: white; z-index: 1001; }
.topbar { background: #202c33; color: #fff; }
.header-inner, #main { max-width: 1480px; margin: 0 auto; padding-inline: var(--gutter); }
.header-inner { display: flex; align-items: stretch; min-height: 59px; gap: clamp(20px, 3.3vw, 52px); }
.brand {
  display: inline-flex; gap: 10px; align-items: center; padding: 0; border: 0;
  color: #fff; background: none; font-size: 1.13rem; font-weight: 625; white-space: nowrap;
}
.brand img { width: 28px; height: 28px; }
.primary-nav { display: flex; align-items: stretch; gap: clamp(15px, 2vw, 30px); }
.primary-nav button {
  padding: 2px 1px 0; border: 0; border-bottom: 2px solid transparent;
  background: none; color: #c1cbd0; font-size: .895rem; font-weight: 510; white-space: nowrap;
}
.primary-nav button:hover, .primary-nav button[aria-current="page"] { color: #fff; }
.primary-nav button[aria-current="page"] { border-bottom-color: #a7cec5; }
.topbar :focus-visible { outline-color: #abd7d0; }
#main { outline: none; padding-top: clamp(21px, 2.4vw, 36px); padding-bottom: 48px; }
.page-title, .card-head, .heading-detail, .dialog-head, .dialog-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.page-title { margin: 0 0 20px; }
.page-title p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.btn, .deck-zoom {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px;
  border: 1px solid #bdc8cb; border-radius: 4px; background: #fff; min-height: 35px;
  font-size: .86rem; font-weight: 560; line-height: 1.25; white-space: nowrap;
}
.btn:hover, .deck-zoom:hover, .icon-btn:hover { background: #f1f4f3; }
.btn.primary { background: var(--teal); color: white; border-color: var(--teal); }
.btn.primary:hover { background: var(--dark-teal); }
.btn.field-action, .edit-link {
  min-height: 30px; border: 0; background: transparent; padding: 4px 0 4px 5px;
  color: var(--teal); font-weight: 570; font-size: .84rem;
}
.btn.field-action:hover, .edit-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { color: var(--over); }
.workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(315px, .89fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.card-head { min-height: 52px; padding: 14px var(--inset) 10px; }
.heading-detail { justify-content: flex-start; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; }
.meta, .small, .muted { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.sheet-section + .sheet-section { border-top: 1px solid var(--line); }
.equip-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 0 var(--inset) 18px; }
.field-select, .form-field { display: grid; min-width: 0; gap: 5px; }
.field-select span, .form-field { font-size: .82rem; font-weight: 540; color: var(--muted); }
.field-select select, .form-field input, .form-field select, .route-context select {
  width: 100%; min-width: 0; padding: 8px 9px; min-height: 37px; border: 1px solid #bcc7cb;
  border-radius: 3px; background: white; color: var(--ink); font-size: .91rem;
}
.deck-section .meta { margin-left: auto; }
#deck { padding: 0 var(--inset) 12px; }
#deck-weights, .deck-zoom { display: none; }
.manifest { padding: 0 var(--inset) 12px; }
.manifest-compare { margin-top: 10px; }
.manifest-table, .axle-table { width: 100%; border-collapse: collapse; text-align: right; font-size: .9rem; }
.manifest-table thead th, .axle-table thead th {
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: .76rem; font-weight: 530;
}
.manifest-table th, .manifest-table td { padding: 9px 6px; }
.manifest-table tr > :first-child, .axle-table tr > :first-child { text-align: left; padding-left: 0; }
.manifest-table tr > :last-child, .axle-table tr > :last-child { padding-right: 0; }
.manifest-table tbody tr + tr, .axle-table tbody tr + tr { border-top: 1px solid #e5e9e9; }
.manifest-table tbody th, .axle-table tbody th { font-weight: 560; overflow-wrap: anywhere; }
.manifest-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-manifest { font-size: .88rem; color: var(--muted); padding-bottom: 10px; }
.summary .card-head { border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.mass-top { padding: 18px var(--inset) 15px; background: #f8f9f8; border-bottom: 1px solid var(--line); }
.mass-label { color: var(--muted); font-size: .85rem; }
.big-num { font-size: clamp(2rem, 3.2vw, 2.65rem); font-weight: 585; letter-spacing: -.035em; line-height: 1.2; }
.big-num small { font-size: 1rem; font-weight: 490; letter-spacing: 0; color: var(--muted); }
.mass-detail { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: .82rem; }
.mass-detail div { display: flex; gap: 5px; }
.mass-detail dt { color: var(--muted); }
.axle-section { padding: 12px var(--inset) 0; }
.axle-table th, .axle-table td { padding: 12px 4px; vertical-align: top; }
.axle-table thead th { padding-block: 4px 8px; white-space: nowrap; }
.axle-table td { white-space: nowrap; }
.reading { font-weight: 635; }
.margin { display: block; font-weight: 445; font-size: .745rem; color: var(--muted); margin-top: 3px; line-height: 1.32; }
.over, .weight-over { color: var(--over); }
.near, .weight-near { color: var(--warn); }
.summary-foot { border-top: 1px solid var(--line); padding: 11px var(--inset); font-size: .77rem; color: var(--muted); line-height: 1.4; }
.notice { display: flex; gap: 8px; align-items: flex-start; border-left: 3px solid #ab7931; background: #faf5eb; color: #754c18; padding: 10px 12px; margin-bottom: 16px; font-size: .84rem; line-height: 1.45; }
.notice svg { flex: none; }
.summary .notice { margin: 0 var(--inset) 12px; }
.route-context { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; padding: 12px var(--inset); margin-bottom: 16px; }
.route-context strong { font-weight: 610; font-size: .96rem; }
.route-context span { color: var(--muted); font-size: .86rem; }
.route-context .btn { margin-left: auto; }
.route-context .btn + .btn { margin-left: 0; }
.route-context select { width: auto; min-height: 35px; font-size: .86rem; }
.empty-view { padding: 36px var(--inset); }
.empty-view > svg { display: none; }
.empty-view p { margin: 6px 0 14px; color: var(--muted); font-size: .9rem; }
.saved-list { padding: 0 var(--inset); }
.saved-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 0;
  border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left;
}
.saved-row:hover { background: #f7f9f8; }
.saved-row:last-child { border-bottom: 0; }
.saved-row svg { flex: none; color: var(--muted); }
.saved-row strong { font-size: .95rem; font-weight: 600; overflow-wrap: anywhere; }
.saved-row .muted { margin-left: auto; white-space: nowrap; }
dialog {
  margin: auto; border: 1px solid #a9b5b9; border-radius: 5px; padding: 0;
  background: white; color: var(--ink); width: min(500px, 95vw); max-height: 90dvh;
  box-shadow: 0 12px 48px #1f303633;
}
dialog::backdrop { background: #202b335c; }
.dialog-head, .dialog-body, .dialog-actions { padding: 15px 20px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-body { display: grid; gap: 14px; }
.dialog-actions { border-top: 1px solid var(--line); gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dialog-actions > .danger { margin-right: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); }
details { color: var(--muted); font-size: .84rem; }
details summary { font-weight: 550; }
details .form-grid { margin-top: 10px; }
#toast {
  position: fixed; z-index: 1100; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #243238; color: white; padding: 11px 16px; border-radius: 4px;
  max-width: 90vw; width: max-content; font-size: .87rem;
}
#toast:empty { display: none; }
@media (max-width: 1000px) {
  .workspace { gap: 14px; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr); }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .header-inner { gap: 20px; }
  #deck-weights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px var(--inset) 12px; gap: 6px; }
  #deck-weights > div { display: grid; gap: 2px; border-left: 1px solid var(--line); padding-left: 10px; }
  #deck-weights > div:first-child { border: 0; padding-left: 0; }
  #deck-weights span, #deck-weights small { color: var(--muted); font-size: .75rem; font-weight: 490; }
  #deck-weights strong { font-weight: 610; font-size: .94rem; }
}
@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; gap: 0 20px; min-height: 50px; }
  .brand { min-height: 42px; }
  .primary-nav { min-height: 40px; gap: 16px; }
  .primary-nav button { font-size: .88rem; }
  .page-title { margin-bottom: 14px; }
  .equip-body { grid-template-columns: 1fr; gap: 9px; padding-bottom: 14px; }
  .card-head { min-height: 47px; padding-top: 10px; }
  .deck-zoom { display: inline-flex; min-height: 30px; padding: 5px 8px; font-size: .8rem; }
  .deck-board.zoomed { overflow-x: auto; }
  .deck-board.zoomed .deck-diagram { width: 650px; max-width: none; }
  .manifest { padding-inline: 12px; }
  .manifest-table { font-size: .84rem; }
  .manifest-table th, .manifest-table td { padding-inline: 3px; }
  .manifest-table thead th { font-size: .73rem; }
  .manifest-table thead th span { display: block; }
  .route-context { gap: 8px 12px; }
  .route-context strong, .route-context span { width: 100%; }
  .route-context .btn { margin-left: 0; }
}
@media (max-width: 375px) {
  :root { --gutter: 10px; --inset: 12px; }
  .heading-detail { column-gap: 7px; }
}
