* { box-sizing: border-box; }
[hidden] { display: none !important; }
.independent-draft-status { margin: 0; color: #666; font: 12px/1.4 Arial,sans-serif; }
[data-work-stale="true"]::before { content: 'SOURCE CHANGED · Saved inputs shown below need updating.'; display: block; padding: 12px; background: #fff0c7; color: #725600; font-size: 12px; font-weight: bold; }
.shipment-import { width: min(1360px, calc(100% - 40px)); margin: 0 auto 18px; padding: 16px; background: #fff8e1; border: 1px solid #b9a45c; font-size: 13px; }
.shipment-import p { margin: 0 0 10px; }
.shipment-import button { margin-right: 8px; }
body { margin: 0; min-height: 100vh; background: var(--tool-canvas); color: var(--tool-black); font-family: Arial, Helvetica, sans-serif; }
button, input, select { font: inherit; }
button, input, select { border: 1px solid var(--tool-black); border-radius: 0; background: #fff; color: #111; }
button { min-height: 36px; padding: 8px 13px; font-weight: 700; cursor: pointer; }
button:hover:not(:disabled), button:focus-visible { background: #111; color: #fff; }
button:disabled { border-color: #c7c7c7; color: #aaa; cursor: not-allowed; }
input, select { width: 100%; min-height: 36px; padding: 7px 9px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #8badff; outline-offset: 1px; }
.app-header { width: min(1360px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0 20px; display: grid; gap: 22px; }
.app-header > div { display: grid; gap: 8px; }
.eyebrow { grid-column: 1 / -1; margin: 0 0 6px; color: var(--tool-muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.app-header h1 { margin: 0; font-size: clamp(32px, 4vw, 46px); line-height: 1.08; letter-spacing: -.04em; }
.app-header > div > p:last-child { max-width: 760px; margin: 0; color: var(--tool-muted); font-size: 14px; line-height: 1.5; }
.calculator-layout { width: min(1360px, calc(100% - 40px)); margin: 0 auto 32px; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr); gap: 16px; align-items: start; }
.calculator-form { display: grid; gap: 16px; }
.panel, .results-column { border: 1px solid var(--tool-black); background: #fff; }
.panel { padding: 17px; }
.section-heading { display: grid; grid-template-columns: 36px 1fr; gap: 10px; margin-bottom: 14px; align-items: center; }
.section-heading > span { width: 32px; height: 32px; display: grid; place-items: center; background: #111; color: #fff; font-size: 10px; font-weight: 700; }
.section-heading h3, .results-header h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-heading p, .results-header > p:last-child { margin: 3px 0 0; color: var(--tool-muted); font-size: 11px; line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
.field-wide { grid-column: span 2; }
.field { min-width: 0; color: #333; font-size: 11px; font-weight: 700; }
.field > span { color: var(--tool-muted); font-weight: 400; }
.field input, .field select { display: block; margin-top: 4px; font-size: 13px; }
.carton-rows { display: grid; gap: 10px; }
.carton-row { min-width: 0; margin: 0; padding: 12px; border: 1px solid #999; }
.carton-row legend { padding: 0 7px; font-size: 12px; font-weight: 700; }
.carton-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.rotation-field { min-height: 36px; display: flex; gap: 7px; align-items: center; padding: 6px 8px; border: 1px solid #aaa; font-size: 11px; cursor: pointer; }
.rotation-field input { width: 17px; min-height: 17px; margin: 0; flex: 0 0 auto; }
.rotation-field strong, .rotation-field small { display: block; }
.rotation-field small { display: none; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.results-column { position: sticky; top: 16px; overflow: hidden; }
.results-header { padding: 17px 20px; border-bottom: 1px solid var(--tool-black); background: #111; color: #fff; }
.results-header .eyebrow, .results-header > p:last-child { color: #cfcfcf; }
.pallet-results { min-height: 390px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid #aaa; }
.summary-metric { min-width: 0; padding: 13px 14px; border-right: 1px solid #aaa; }
.summary-metric:last-child { border-right: 0; }
.summary-metric span { display: block; color: var(--tool-muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.summary-metric strong { display: block; margin-top: 5px; font-size: 20px; }
.result-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr); border-bottom: 1px solid #aaa; }
.result-copy, .layer-visual { padding: 16px; }
.layer-visual { border-left: 1px solid #aaa; background: #f6f6f4; }
.result-card h4 { margin: 0 0 11px; font-size: 15px; }
.metric-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; margin: 0; }
.metric-list div { padding-top: 7px; border-top: 1px solid #ccc; }
.metric-list dt { color: var(--tool-muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.metric-list dd { margin: 3px 0 0; font-size: 13px; font-weight: 700; }
.layer-visual svg { max-width: 100%; max-height: 225px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.layer-visual p { margin: 8px 0 0; color: var(--tool-muted); font-size: 10px; line-height: 1.35; text-align: center; }
.result-error { margin: 0; padding: 18px; border-left: 6px solid #a40000; color: #760000; font-size: 13px; line-height: 1.45; }
.assumptions { margin: 0; padding: 14px 16px 14px 32px; color: var(--tool-muted); font-size: 10px; line-height: 1.4; }
.mixed-plan-controls { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px; border-bottom: 1px solid #aaa; }
.mixed-plan-controls label { flex: 1; min-width: 110px; font-size: 12px; font-weight: bold; }
.mixed-plan-controls select { display: block; margin-top: 6px; width: 100%; }
.mixed-pallet-contents { padding-left: 18px; font-size: 12px; line-height: 1.7; }
.empty-results { margin: 0; padding: 28px 22px; color: var(--tool-muted); font-size: 13px; }
@media (min-width: 1041px) {
  body { min-height: 100dvh; display: flex; flex-direction: column; }
  .app-header { flex: 0 0 auto; }
  .calculator-layout { min-height: 0; margin-bottom: 20px; align-items: stretch; }
  .calculator-form { min-height: 0; grid-template-rows: auto auto; }
  .panel { min-height: 0; display: flex; flex-direction: column; }
  .section-heading { flex: 0 0 auto; }
  .field-grid { align-content: start; }
  .field { font-size: 12px; }
  .field input, .field select { font-size: 14px; }
  .carton-rows { min-height: 0; align-content: start; }
  .carton-row { padding: 14px 12px; }
  .carton-fields { row-gap: 16px; }
  .row-actions { flex: 0 0 auto; }
  .results-column { position: static; min-height: 0; display: flex; flex-direction: column; }
  .results-header { flex: 0 0 auto; }
  .pallet-results { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
  .summary-strip, .assumptions { flex: 0 0 auto; }
  .result-card { flex: 1 0 auto; }
  .result-copy { align-self: start; }
  .metric-list { row-gap: 16px; }
  .metric-list dt { font-size: 10px; }
  .metric-list dd { font-size: 15px; }
  .layer-visual { display: flex; flex-direction: column; justify-content: center; }
  .layer-visual svg { max-height: 300px; }
}
@media (max-width: 1040px) {
  .calculator-layout { grid-template-columns: 1fr; }
  .results-column { position: static; }
  .carton-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-header { width: min(100% - 24px, 680px); padding-top: 16px; grid-template-columns: 1fr; }
  .app-header > div { grid-template-columns: 1fr; }
  .app-header > div > p:last-child { margin-top: 8px; }
  .calculator-layout { width: min(100% - 24px, 680px); }
  .panel { padding: 16px; }
  .field-grid, .carton-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-wide, .rotation-field { grid-column: 1 / -1; }
  .result-card { grid-template-columns: 1fr; }
  .layer-visual { border-top: 1px solid #aaa; border-left: 0; }
}
@media (max-width: 420px) {
  .field-grid, .carton-fields, .summary-strip { grid-template-columns: 1fr; }
  .summary-metric { border-right: 0; border-bottom: 1px solid #aaa; }
  .summary-metric:last-child { border-bottom: 0; }
  .row-actions { flex-direction: column; }
}

.planner-nav, .pallet-heading { width: min(1360px, calc(100% - 40px)); margin: 0 auto; }
.planner-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0 0 18px; }
.planner-nav a { color: #333; font-size: 12px; font-weight: 700; text-underline-offset: 4px; }
.pallet-heading { border-top: 1px solid #aaa; padding: 20px 0; }
.pallet-heading h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.pallet-heading p { margin: 8px 0 0; color: var(--tool-muted); font-size: 13px; }
#pallet-title, #truck-title { scroll-margin-top: 20px; }
@media (max-width: 760px) {
  .planner-nav, .pallet-heading { width: calc(100% - 24px); }
  .pallet-heading h2 { font-size: 28px; }
}
.truck-workspace { width: min(1360px, calc(100% - 40px)); margin: 32px auto 40px; }
.truck-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 24px 0 20px; border-top: 1px solid #aaa; }
.truck-heading h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.truck-heading p:last-child { margin: 8px 0 0; color: var(--tool-muted); font-size: 13px; }
.truck-import { display: flex; align-items: end; gap: 10px; }
.truck-import .field { max-width: 150px; }
.truck-import button { white-space: nowrap; }
.truck-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.truck-inputs { display: grid; gap: 16px; min-width: 0; }
.vehicle-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
#load-groups { display: grid; gap: 12px; }
.mixed-stacking { margin-bottom: 14px; padding: 10px; background: #f6f7f4; }
.mixed-stacking small { display: block; margin-top: 3px; color: #666; font-weight: normal; }
.load-group { margin: 0; min-width: 0; border: 1px solid #aaa; padding: 12px; }
.load-group legend { padding: 0 6px; font-size: 12px; font-weight: 700; }
.load-group-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 9px; align-items: end; }
.load-name { grid-column: span 2; }
.load-group-fields .rotation-field { grid-column: span 2; }
.load-group-fields button { font-size: 12px; }
.load-group-fields input:disabled { background: #eee; border-color: #ccc; }
.truck-output { background: #fff; border: 1px solid #111; min-width: 0; overflow: hidden; }
.truck-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.truck-summary .summary-metric { border-bottom: 1px solid #bbb; }
.truck-summary .summary-metric:nth-child(3n) { border-right: 0; }
.truck-summary .summary-metric:first-child strong { color: #2d617a; }
.load-view-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 14px 16px; }
.load-view-controls button { font-size: 12px; }
.load-view-controls button[aria-pressed="true"] { color: #fff; background: #111; }
.load-zoom { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 11px; }
.load-zoom input { width: 80px; min-height: 24px; padding: 0; }
.load-diagram-scroll { overflow: auto; background: #fafbf9; border-block: 1px solid #ddd; }
#load-diagram { min-width: 100%; min-height: 280px; }
#load-diagram svg { display: block; width: 100%; min-height: 280px; max-height: 460px; }
.load-pallet { cursor: pointer; outline: none; }
.load-pallet:hover polygon, .load-pallet.selected polygon, .load-pallet:focus-visible polygon { stroke: #e59625; stroke-width: 3px; }
.load-selection { margin: 0; padding: 12px 16px; font-size: 12px; line-height: 1.5; min-height: 60px; }
.load-legend { display: flex; gap: 10px 16px; flex-wrap: wrap; padding: 0 16px 14px; font-size: 11px; }
.load-legend span { display: inline-flex; align-items: center; gap: 5px; }
.load-legend i { width: 10px; height: 10px; display: inline-block; }
.load-warning { background: #fff5df; margin: 0 16px 10px; padding: 10px; color: #72501d; font-size: 12px; line-height: 1.5; }
.load-note { margin: 0; padding: 14px 16px; border-top: 1px solid #ddd; color: #666; font-size: 11px; line-height: 1.5; }
.app-header { grid-template-columns: minmax(0, 1fr); }
.measurement-toggle, .app-header > .measurement-toggle { display: inline-flex; gap: 0; align-self: center; flex: 0 0 auto; }
.measurement-toggle button { min-height: 38px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.measurement-toggle button + button { border-left: 0; }
.measurement-toggle button[aria-pressed="true"] { background: #111; color: #fff; }
.cargo-heading { grid-template-columns: 36px minmax(0, 1fr) auto; }
.truck-heading { flex-wrap: wrap; align-items: center; }
.truck-heading > div:first-child { flex: 1; min-width: 260px; }
@media (max-width: 1040px) {
  .truck-layout { grid-template-columns: 1fr; }
  .truck-heading { align-items: start; }
}
@media (max-width: 760px) {
  .cargo-heading .measurement-toggle { grid-column: 2 / -1; justify-self: start; }
  .app-header { grid-template-columns: 1fr; }
  .app-header > .measurement-toggle { justify-self: start; }
  .truck-workspace { width: calc(100% - 24px); }
  .truck-heading { flex-direction: column; }
  .truck-heading > div:first-child { min-width: 0; width: 100%; }
  .truck-heading .measurement-toggle { align-self: start; }
  .truck-heading h2 { font-size: 28px; }
  .truck-import { width: 100%; flex-wrap: wrap; }
  .vehicle-fields, .load-group-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .load-group-fields .rotation-field { grid-column: auto; }
  .truck-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .truck-summary .summary-metric:nth-child(3n) { border-right: 1px solid #aaa; }
  .truck-summary .summary-metric:nth-child(2n) { border-right: 0; }
  .load-view-controls { padding: 12px; }
  .load-zoom { margin-left: 0; }
}
