:root {
  color-scheme: light;
  font-family: Lato, "Segoe UI", Arial, sans-serif;
  --ink: #2d2826;
  --muted: #566471;
  --blue: #6b98bf;
  --blue-ink: #325a7c;
  --lime: #d4d947;
  --line: #dce3e8;
  --paper: #fff;
  color: var(--ink);
  background: #f4f6f8;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, a { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #375f88; outline-offset: 3px; }
.top :focus-visible { outline-color: var(--lime); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 20px; line-height: 1.2; letter-spacing: -.025em; }

.top { background: var(--ink); color: white; }
.top-inner, main { max-width: 1680px; margin-inline: auto; padding-inline: clamp(18px, 3.3vw, 54px); }
.top-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand, nav { display: flex; align-items: center; }
.brand { gap: 22px; }
.brand img { width: 177px; height: auto; display: block; }
.brand span { padding-left: 22px; border-left: 1px solid #686361; color: #eeeceb; font-size: 15px; }
nav { align-self: stretch; gap: 18px; }
nav a { position: relative; display: grid; align-self: stretch; align-items: center; padding: 0 5px; color: #e0dedc; text-decoration: none; font-weight: 600; font-size: 14px; }
nav a:focus-visible { outline-offset: -3px; }
nav a:hover, nav a[aria-current] { color: #fff; }
nav a[aria-current]::after { content: ""; position: absolute; height: 3px; background: var(--lime); inset: auto 5px 0; }

main { display: grid; grid-template-columns: clamp(232px, 18.6vw, 285px) minmax(0, 1fr); align-items: start; gap: clamp(18px, 2vw, 34px); padding-block: clamp(20px, 2.4vw, 38px) 56px; }
aside, .group, .empty { border: 1px solid var(--line); background: var(--paper); border-radius: 14px; }
aside { padding: 18px 15px 14px; min-width: 0; position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.railhead, .dialogbar, .dialogfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.railhead { margin-bottom: 17px; }
.icon, .soft, .dialogbar button, .dialogfoot button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid #cbd5dc; border-radius: 7px; background: white; color: var(--blue-ink); font-weight: 600; }
.icon { width: 36px; height: 36px; padding: 0; }
.soft, .dialogbar button, .dialogfoot button { min-height: 36px; padding: 7px 12px; font-size: 13px; }
button:not(:disabled):is(.soft,.icon):hover, .dialogbar button:hover, .dialogfoot button:not(:disabled):hover { background: #edf3f7; border-color: #9bb4c9; }
.soft { margin-top: 12px; }
label, .minor, .amount-label, .amount-note { font-size: 12px; line-height: 1.45; color: var(--muted); }
label { font-weight: 600; display: block; margin-bottom: 6px; }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #627887; pointer-events: none; }
input { width: 100%; min-width: 0; font-size: 13px; line-height: 20px; padding: 10px 7px 10px 34px; border: 1px solid #cbd5dc; border-radius: 8px; background: white; color: var(--ink); }
input::placeholder { color: #616f7c; }
#routes { margin-top: 15px; overflow-y: auto; display: grid; gap: 6px; padding: 4px; margin-inline: -4px; }
.route { position: relative; display: block; width: 100%; min-width: 0; text-align: left; border: 1px solid transparent; border-radius: 8px; padding: 10px 28px 10px 13px; background: transparent; }
.route:hover { background: #f2f6f9; }
.route[aria-current] { background: #e8f0f6; border-color: #bfd1df; }
.route[aria-current]::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; background: var(--blue-ink); border-radius: 3px; }
.route[aria-current]::after { content: ""; position: absolute; right: 13px; top: calc(50% - 4px); width: 7px; height: 7px; border: solid var(--blue-ink); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.route strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.route small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.railmsg { color: var(--muted); font-size: 14px; padding: 5px; }

.desk { min-width: 0; }
.hero { isolation: isolate; position: relative; display: flex; align-items: center; min-height: 174px; overflow: hidden; border: 1px solid #cbd9e3; border-radius: 14px; background: linear-gradient(110deg, #f3f7fa, #e7eff4 64%, #d6e3ed); }
.hero::before { position: absolute; z-index: -2; content: ""; inset: 0 0 0 52%; background-image: linear-gradient(to right, #90acc033 1px, transparent 1px), linear-gradient(to bottom, #90acc033 1px, transparent 1px); background-size: 23px 23px; mask-image: linear-gradient(to right, transparent, #000 50%); }
.hero-copy { padding: 25px clamp(19px, 2.3vw, 38px); width: 72%; }
.kicker { display: flex; align-items: center; gap: 9px; font-size: 11px; line-height: 1.45; font-weight: 700; letter-spacing: .105em; text-transform: uppercase; color: var(--blue-ink); }
.kicker::before { content: ""; width: 19px; height: 4px; background: var(--blue); }
h1 { margin: 9px 0 13px; font-size: clamp(27px, 2.8vw, 45px); font-weight: 700; letter-spacing: -.045em; line-height: 1.1; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 5px 0; color: #475a68; font-size: 13px; line-height: 1.5; }
.facts > span + span { margin-left: 12px; padding-left: 12px; border-left: 1px solid #bdcbd5; }
.facts b { margin-left: 2px; font-variant-numeric: tabular-nums; color: #283941; }
.pallets { position: absolute; z-index: -1; right: 4%; top: 50%; transform: translateY(-50%); width: min(30%, 238px); height: auto; mask-image: linear-gradient(90deg, transparent, #000 11%, #000 97%, transparent), linear-gradient(to top, transparent, #000 13%); mask-composite: intersect; }
.party-heading { margin: 24px 0 12px; }
.group { overflow: clip; margin-bottom: 13px; box-shadow: 0 2px 5px #24314106; }
.ghead { display: grid; grid-template-columns: 16px minmax(0, 1.55fr) repeat(2, minmax(0, .88fr)) auto; align-items: center; gap: 12px; padding: 17px clamp(14px, 1.5vw, 24px); cursor: pointer; list-style: none; }
.ghead::-webkit-details-marker { display: none; }
.ghead:focus-visible { outline-offset: -3px; border-radius: 12px; }
.ghead:hover { background: #f4f7fa; }
.ghead::before { content: ""; width: 7px; height: 7px; border: solid var(--blue-ink); border-width: 0 2px 2px 0; transform: rotate(-45deg); justify-self: center; }
.group[open] > .ghead::before { transform: rotate(45deg); }
.gtitle { font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.group-amount { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.group-amount strong { font-size: 15px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.group-amount .amount-review { color: #7c5012; }
.amount-note { font-size: 11px; }
.gphotos, .photo-number { display: inline-block; width: fit-content; white-space: nowrap; border-radius: 5px; font-size: 12px; line-height: 1.35; font-weight: 650; padding: 4px 8px; }
.gphotos { color: #425d72; background: #edf2f5; }
.sheet { display: grid; grid-template-columns: clamp(95px, 9vw, 132px) minmax(0, 1fr); align-items: start; gap: clamp(14px, 1.6vw, 25px); border-top: 1px solid var(--line); padding: 20px clamp(14px, 1.5vw, 24px); }
.thumbnail { width: 100%; display: grid; justify-items: center; gap: 8px; border: 1px solid #cfd9e1; border-radius: 8px; padding: 10px 7px 8px; color: var(--blue-ink); background: #f1f4f6; }
.thumbnail:not(:disabled):hover { background: #e6eff5; border-color: var(--blue); }
.thumbnail img { display: block; max-width: 100%; height: 108px; object-fit: contain; }
.previewbtn { font-size: 12px; font-weight: 650; }
.fields { min-width: 0; }
.sheet h3 { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 9px; row-gap: 5px; line-height: 1.35; margin: 0 0 6px; font-size: 17px; letter-spacing: -.015em; }
.photo-number { color: #365570; background: #e9f0f5; letter-spacing: 0; }
.photo-divider { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.sub { font-size: 14px; line-height: 1.55; color: var(--muted); }
.sheet p { margin: 4px 0 8px; }
.minor { display: block; font-weight: 600; }
.flag { display: inline-block; padding: 3px 8px; background: #fff0cb; color: #754b0c; font-size: 12px; font-weight: 600; border-radius: 4px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-top: 1px solid #e0e6ea; vertical-align: top; overflow-wrap: anywhere; }
thead { background: #f4f6f8; }
thead th { color: #4d5d69; font-size: 12px; font-weight: 600; }
thead th:nth-last-child(-n+2), td.amount { text-align: right; }
td.amount { white-space: nowrap; }
tfoot { background: #edf2f5; font-weight: 700; }
tfoot th, tfoot td { border-color: #c9d6df; }
.empty { margin-top: 18px; padding: clamp(24px, 4vw, 55px); text-align: center; }
.empty img { width: 36px; height: 36px; margin-bottom: 10px; }
.empty .sub { max-width: 430px; margin: 7px auto 12px; }
.link { color: var(--blue-ink); font-weight: 650; }
#content > .sub { margin-top: 20px; }
dialog { border: 1px solid var(--line); padding: 0; border-radius: 13px; width: min(1120px, 95vw); max-width: 100%; height: 90dvh; background: #e4e9ed; color: var(--ink); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #191b1cce; }
.dialogbar, .dialogfoot { flex: none; padding: 11px 15px; background: white; font-size: 14px; }
.dialogbar { border-bottom: 1px solid var(--line); }
.dialogbar b { overflow-wrap: anywhere; min-width: 0; }
.dialogbar > div { display: flex; flex: none; gap: 6px; }
.dialogfoot { border-top: 1px solid var(--line); }
#canvas { flex: 1; min-height: 0; overflow: auto; padding: 8px; text-align: center; }
#canvas img { height: 100%; max-width: 100%; object-fit: contain; }
#canvas.zoom { text-align: left; }
#canvas.zoom img { width: auto; height: auto; max-width: none; }

@media (max-width: 1110px) {
  .ghead { grid-template-columns: 14px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 12px; }
  .gtitle { grid-column: 2 / 4; grid-row: 1; }
  .gphotos { grid-column: 4; grid-row: 1; }
  .group-amount { grid-row: 2; }
  .group-amount:nth-child(2) { grid-column: 2; }
  .group-amount:nth-child(3) { grid-column: 3 / 5; }
}
@media (max-width: 800px) {
  main { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 16px 36px; }
  aside { position: static; padding: 14px 15px 10px; max-height: none; }
  .railhead { margin-bottom: 8px; }
  #routes { grid-auto-flow: column; grid-auto-columns: minmax(155px, max-content); justify-content: start; overflow: auto; margin-top: 7px; }
  .route { padding-block: 7px; }
  .hero { min-height: 145px; }
  .party-heading { margin-top: 20px; }
}
@media (max-width: 600px) {
  .top-inner, main { padding-inline: 12px; }
  .top-inner { min-height: 58px; gap: 10px; }
  .brand { gap: 0; }
  .brand img { width: clamp(108px, 30vw, 150px); }
  .brand span { display: none; }
  nav { gap: 6px; }
  nav a { padding-inline: 4px; font-size: 12px; }
  .railhead h2, .party-heading { font-size: 18px; }
  .hero-copy { width: 75%; padding: 17px 13px; }
  .hero { min-height: 130px; }
  .pallets { width: 26%; right: 0; }
  h1 { font-size: clamp(24px, 5.9vw, 32px); }
  .kicker { gap: 6px; font-size: 9px; }
  .facts { font-size: 12px; }
  .facts > span + span { margin-left: 7px; padding-left: 7px; }
  .ghead { padding: 13px 11px; gap: 8px; }
  .gtitle { font-size: 15px; }
  .group-amount strong { font-size: 14px; }
  .sheet { display: flow-root; padding: 14px; }
  .thumbnail { float: left; width: 65px; margin: 0 12px 8px 0; padding: 4px; gap: 3px; }
  .thumbnail img { height: 64px; }
  .previewbtn { font-size: 10px; }
  .sheet h3 { display: block; font-size: 15px; }
  .photo-number { margin: 0 5px 3px 0; font-size: 11px; }
  .sub { font-size: 13px; }
  .scroll { clear: both; }
  .sheet table, .sheet tbody, .sheet tfoot { display: block; }
  .sheet thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sheet tbody tr, .sheet tfoot tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; border-top: 1px solid var(--line); padding: 10px 5px; }
  .sheet td, .sheet td.amount { padding: 0; border: 0; text-align: left; white-space: normal; }
  .sheet td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
  .sheet tfoot th { grid-column: 1 / -1; padding: 0; border: 0; }
  .dialogbar, .dialogfoot { gap: 6px; padding: 8px; font-size: 12px; }
  .dialogbar button, .dialogfoot button { padding: 5px 7px; font-size: 12px; }
}
@media (max-width: 365px) {
  .hero-copy { width: 81%; }
  .pallets { width: 20%; }
}
