:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #17272b;
  background: #f5f7f6;
  font-synthesis: none;
  --ink: #17272b;
  --muted: #586c6d;
  --soft-ink: #395151;
  --line: #dce6e3;
  --surface: #fff;
  --surface-soft: #f6f9f8;
  --pine: #115e52;
  --pine-dark: #0b4b42;
  --pine-light: #e8f4ef;
  --sidebar: #142b30;
  --danger: #a13733;
  --radius: 17px;
  --shadow: 0 2px 5px rgb(21 44 48 / 3%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #75bda9; outline-offset: 2px; }

h1, h2, h3, p { margin: 0; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  min-height: 100vh;
  padding: 28px 16px;
  color: #e3f4ef;
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px;
}

.brand-symbol {
  display: grid;
  flex: 0 0 39px;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  align-content: center;
  justify-content: center;
  gap: 3px;
  width: 39px;
  height: 39px;
  border-radius: 11px;
  background: #b5ead3;
  transform: rotate(-5deg);
}

.brand-symbol i {
  display: block;
  border-radius: 1.3px;
  background: #14594e;
}

.brand-symbol i:first-child { grid-row: span 2; }

.brand-text {
  color: #fff;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -.045em;
}

.brand-text span {
  display: block;
  margin-top: 4px;
  color: #a8c4bf;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav { margin-top: 50px; }
.nav-caption {
  margin: 0 0 9px;
  padding-left: 11px;
  color: #a8c4bf;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.nav-caption:not(:first-child) { margin-top: 27px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  width: 100%;
  margin: 3px 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #d6e7e4;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.nav-link .icon { opacity: .84; }
.nav-link:hover { background: #203c40; }
.nav-link.is-active, .nav-link[aria-current="page"], .nav-link.active {
  color: #d4f8e6;
  border-color: #366057;
  background: #254b46;
}
.nav-link.is-active .icon, .nav-link[aria-current="page"] .icon, .nav-link.active .icon {
  color: #b7eed2;
  opacity: 1;
}

.account-summary {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 22px 4px 0;
  padding: 10px 7px 0;
  border-top: 1px solid #355356;
  color: #d6e7e4;
}
.account-summary > .icon { width: 17px; height: 17px; margin-top: 2px; color: #a9c8bf; }
.account-details { display: grid; justify-items: start; gap: 3px; min-width: 0; }
#account-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 12px; }
.account-switch {
  padding: 1px 0;
  border: 0;
  color: #b7ead7;
  background: transparent;
  text-align: left;
  font-size: 11px;
  line-height: 1.4;
}
.account-switch:hover { text-decoration: underline; }

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 20px;
}
.login-card { width: min(100%, 390px); padding: clamp(20px, 5vw, 33px); }
.login-brand { padding: 0; }
.login-brand .brand-text { color: var(--ink); }
.login-brand .brand-symbol { flex-basis: 36px; width: 36px; height: 36px; }
.login-card h1 { margin: 21px 0 17px; font-size: 25px; font-weight: 750; letter-spacing: -.04em; line-height: 1.15; }
.login-form, .login-fields { display: grid; gap: 11px; }
.login-form .form-status { margin-top: 0; }

.main {
  min-width: 0;
  width: 100%;
  max-width: 1670px;
  padding: clamp(27px, 3.2vw, 49px) clamp(22px, 3.05vw, 47px) 44px;
}

.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: clamp(29px, 3.1vw, 43px);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -.052em;
}
.page-header p {
  max-width: 650px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.planner-grid, .directory-grid {
  display: grid;
  align-items: start;
  gap: 20px;
}
.planner-grid { grid-template-columns: minmax(355px, .86fr) minmax(0, 1.14fr); }
.directory-grid { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); }

.card {
  min-width: 0;
  padding: clamp(16px, 1.8vw, 27px);
  border: 1px solid #dfe8e5;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-header, .section-heading, .canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-header { margin-bottom: 19px; }
.order-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; }
.card-header h2 {
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.2;
}
.card-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.section-heading h3, .canvas-header h3 {
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -.012em;
}

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dimension-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 660;
  line-height: 1.4;
}

input:not([type="checkbox"]), select {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cedbd8;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

input::placeholder { color: #6f8180; opacity: 1; }
select { padding-right: 6px; }
input:not([type="checkbox"]):hover, select:hover { border-color: #a2b9b2; }

.order-lines-section {
  margin-top: 21px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.order-lines-heading { flex-wrap: wrap; gap: 4px 10px; }
.order-lines-heading-actions { display: flex; flex-wrap: wrap; gap: 2px 8px; }

.order-lines-labels, .order-line {
  display: grid;
  grid-template-columns: 20px minmax(80px, 1fr) minmax(114px, 136px) 75px;
  align-items: center;
  gap: 7px;
}

.order-lines-labels {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 670;
}
.order-lines-labels span:first-child { text-align: center; }
.order-lines { display: grid; gap: 7px; }
.order-group, .order-group-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; }
.order-group { border-radius: 8px; }
.order-group.is-drag-over { outline: 2px solid #75bda9; outline-offset: 2px; }
.order-group-header {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.order-group-header input.order-group-title {
  flex: 1 1 100px;
  width: auto;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 660;
}
.order-group-position { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-group-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.order-group-header .order-group-drag { flex: 0 0 24px; width: 24px; cursor: grab; }
.order-group-header .order-group-drag:active { cursor: grabbing; }
.order-group-drag > span:empty {
  display: block;
  width: 10px;
  height: 15px;
  background: radial-gradient(currentColor 1px, transparent 1.4px) 0 0 / 5px 5px;
  pointer-events: none;
}
.order-group-footer { padding: 0 0 4px 17px; border-bottom: 1px solid var(--line); }
.order-group-footer .text-button { min-height: 27px; }
.order-line .field { width: 100%; }
.order-line input, .order-line select { min-height: 36px; padding-block: 6px; }
.order-product-picker { position: relative; min-width: 0; }
.order-product-picker > input[type="text"] { display: block; }
.order-product-picker:has(.order-product-create:not([hidden])) > input[type="text"] { padding-inline-end: 34px; }
.order-product-picker > input[aria-expanded="true"] { border-color: #94b5aa; }
.order-product-picker .order-product-create {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  width: 28px;
  height: 28px;
  color: var(--pine-dark);
  background: var(--pine-light);
}
.order-product-options {
  --option-height: 38px;
  position: absolute;
  z-index: 5;
  inset-block-start: calc(100% + 4px);
  inset-inline-start: 0;
  width: max(100%, min(300px, calc(100vw - 76px)));
  max-height: calc(8 * var(--option-height) + 8px);
  margin: 0;
  padding: 3px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  list-style: none;
  border: 1px solid #b7cec6;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgb(21 44 48 / 13%);
}
.order-product-options [role="option"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 1px;
  height: var(--option-height);
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 5px;
  cursor: pointer;
}
.order-product-options [role="option"]:hover { background: var(--surface-soft); }
.order-product-options [role="option"][aria-selected="true"] { background: var(--pine-light); }
.order-product-code, .order-product-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.order-product-code { color: var(--pine-dark); font-size: 12px; font-weight: 700; }
.order-product-name { color: var(--muted); font-size: 11px; }
.order-product-name:empty { display: none; }
.order-product-options[data-state="empty"], .order-product-options [data-state="empty"] {
  padding: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.order-product-message {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.order-line select.line-group-select {
  grid-column: 2 / -1;
  justify-self: end;
  width: min(100%, 190px);
  min-height: 28px;
  padding: 3px 6px;
  border-color: var(--line);
  color: var(--soft-ink);
  font-size: 11px;
}
.line-quantity { min-width: 0; }
.line-quantity-label { display: none; }
.line-quantity-controls {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  min-width: 0;
  border: 1px solid #cedbd8;
  border-radius: 8px;
  background: #fff;
}
.line-quantity-controls:focus-within { border-color: #75bda9; }
.line-quantity-controls input[type="number"] {
  appearance: textfield;
  min-height: 34px;
  padding-inline: 3px;
  border: 0;
  border-inline: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.line-quantity-controls input::-webkit-inner-spin-button,
.line-quantity-controls input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.quantity-step {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--pine);
  background: var(--surface-soft);
}
.quantity-step:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
.quantity-step:last-child { border-start-start-radius: 0; border-end-start-radius: 0; }
.quantity-step:disabled { color: #8a9e98; }
.quantity-step:hover:not(:disabled) { background: var(--pine-light); }
.quantity-step .icon { width: 15px; height: 15px; stroke-width: 2; }
.line-quantity-controls :focus-visible { outline-offset: -3px; }
.line-index {
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.line-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.line-package-preview {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.line-package-preview:empty { display: none; }
.line-order-area { color: var(--pine-dark); font-weight: 680; }

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 0 3px 5px;
  border: 0;
  color: var(--pine);
  background: transparent;
  text-align: right;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}
.text-button .icon { width: 15px; height: 15px; }
.text-button:hover { color: var(--pine-dark); text-decoration: underline; }

.icon-button {
  display: inline-grid;
  flex: 0 0 23px;
  place-items: center;
  width: 23px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--soft-ink);
  background: transparent;
}
.icon-button .icon { width: 16px; height: 16px; }
.icon-button:hover:not(:disabled) { color: var(--pine-dark); background: var(--pine-light); }
.icon-button:disabled { opacity: .35; }
.icon-button.line-remove:hover:not(:disabled) { color: var(--danger); background: #faeeeb; }
.print-button { flex-basis: 34px; width: 34px; height: 34px; border-color: var(--line); }
.print-button .icon { width: 17px; height: 17px; }

.field-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.order-options {
  display: grid;
  gap: 11px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.checkbox-field input { flex: 0 0 auto; width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--pine); }
.checkbox-field:has(input:disabled) { color: var(--muted); }
.order-stacking-options { display: grid; gap: 7px; }
.order-stacking-options .field-hint { margin: -3px 0 0 23px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.button-primary { border-color: var(--pine); color: #fff; background: var(--pine); }
.button-primary:hover:not(:disabled) { border-color: var(--pine-dark); background: var(--pine-dark); }
.button-secondary { border-color: var(--line); color: var(--soft-ink); background: var(--surface); }
.button-secondary:hover:not(:disabled) { border-color: #afc9c2; background: var(--surface-soft); }
.button:disabled { opacity: .55; }
.calculate-button { justify-content: space-between; width: 100%; margin-top: 16px; padding-inline: 14px; }
.calculate-button .icon { width: 17px; height: 17px; }

.form-status {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #ccdfdc;
  border-radius: 8px;
  color: var(--soft-ink);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.45;
}
.form-status[data-kind="error"] { border-color: #edccc7; color: var(--danger); background: #fff3f0; }
.form-status[data-kind="warning"] { border-color: #eddcaa; color: #6c4d16; background: #fff9e9; }
.form-status[data-kind="success"] { border-color: #c9e7d9; color: var(--pine-dark); background: var(--pine-light); }
.form-status p + p { margin-top: 5px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 17px;
}
.metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 66px;
  padding: 9px;
  border: 1px solid #e3ece9;
  border-radius: 9px;
  background: #f7faf9;
}
.metric:first-child { border-color: #dcebe5; background: #eef7f2; }
.metric-measure { display: grid; gap: 3px; }
.metric-measure + .metric-measure { border-top: 1px solid var(--line); padding-top: 5px; }
.metric-measure-detail { color: var(--muted); font-size: 10px; line-height: 1.25; }
.metric-label {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  line-height: 1.3;
}
.metric strong {
  overflow-wrap: anywhere;
  color: var(--pine-dark);
  font-size: clamp(15px, 1.75vw, 24px);
  font-weight: 740;
  line-height: 1.07;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
}

.result-canvas-shell {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background-color: #f3f8f6;
  background-image: radial-gradient(#d9e6e1 1px, transparent 1px);
  background-size: 14px 14px;
}
.canvas-header {
  flex-wrap: wrap;
  min-height: 26px;
  color: var(--soft-ink);
}
.canvas-header h3 { padding: 3px 5px; border-radius: 5px; background: #f3f8f6; }
.result-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  min-height: 181px;
  padding: 17px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}
.empty-diagram { display: flex; align-items: center; gap: 4px; width: min(168px, 60vw); }
.empty-cab {
  flex: 0 0 24px;
  height: 33px;
  border: 2px solid #b0c7bd;
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: #e8f1ed;
}
.empty-trailer {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  height: 41px;
  padding: 5px;
  border: 2px solid #b0c7bd;
  border-radius: 4px;
  background: var(--surface-soft);
}
.empty-trailer i { border: 1px dashed #bbcfc6; border-radius: 2px; }

.result-vehicles { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; max-width: 100%; }
.result-vehicles button, .vehicle-tab {
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid #c9dbd5;
  border-radius: 6px;
  color: var(--soft-ink);
  background: #fff;
  font-size: 10px;
  font-weight: 650;
}
.result-vehicles button[aria-selected="true"],
.result-vehicles button[aria-pressed="true"],
.result-vehicles button[aria-current="true"],
.result-vehicles button.is-active,
.result-vehicles button.active { border-color: var(--pine); color: #fff; background: var(--pine); }

.result-layout { display: grid; place-items: center; min-width: 0; }
.result-layout:not(:empty) { min-height: 130px; }
.result-layout svg { display: block; width: 100%; height: auto; max-height: 310px; }
.layout-diagram-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 6px;
}
.layout-diagram-scroll:focus-visible { outline-offset: -2px; }
.layout-diagram-scroll.has-plan-ground svg { min-width: 420px; max-height: none; }
.layout-diagram-scroll.is-layered svg { min-width: 580px; }
.layout-diagram-scroll.has-layout-groups svg { min-width: 580px; max-height: none; }
.layout-group-stripe { pointer-events: none; }
.layout-group-swatch {
  display: inline-block;
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.layout-group-legend { max-width: 100%; }
.layout-group-legend span { min-width: 0; overflow-wrap: anywhere; }
.result-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.result-legend:empty { display: none; }
.result-legend:not(:empty) { margin-top: 4px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border: 1px solid #e0ebe6;
  border-radius: 5px;
  color: #355050;
  background: #f9fcfb;
  font-size: 10px;
  font-weight: 650;
}
.legend-swatch, .legend-color {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border: 1px solid rgb(20 43 48 / 20%);
  border-radius: 2px;
}

.result-header-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; gap: 6px; }
.result-card-header { flex-wrap: wrap; }
.result-view-toggle { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.result-view-toggle[aria-pressed="true"] { border-color: #afc9c2; color: var(--pine-dark); background: var(--pine-light); }

.save-project-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}
.save-project-form .form-status { grid-column: 1 / -1; margin-top: 0; }
.projects-card { max-width: 890px; }
.projects-card .form-status { margin: 0 0 10px; }
.projects-list .directory-item-actions { align-items: center; }

.result-editor {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}
.result-canvas-shell:not([hidden]) + .result-editor { margin-top: 12px; }
.editor-header { margin-bottom: 9px; }
.editor-header h3 { font-size: 14px; font-weight: 720; }
.editor-help {
  max-width: 70ch;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.editor-tools, .editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}
.editor-tools { gap: 6px 10px; margin-bottom: 8px; }
.editor-return-coordinates { margin-top: 6px; }
.editor-own-pallet { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.editor-actions { gap: 4px; }
.editor-tools:empty { display: none; }
.editor-tools button {
  min-height: 32px;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 5px 8px;
  border: 1px solid #c9dbd5;
  border-radius: 6px;
  color: var(--soft-ink);
  background: #fff;
  font-size: 11px;
  font-weight: 650;
}
.editor-tools button:not(:disabled):hover { border-color: #95b8ac; }
.editor-tools button[aria-pressed="true"] { color: #fff; border-color: var(--pine); background: var(--pine); }
.editor-tools select, .editor-tools input:not([type="checkbox"]) { width: auto; min-height: 32px; max-width: 100%; font-size: 11px; }
.editor-tools input.editor-coordinate { width: 88px; }
.editor-viewport {
  overflow: hidden;
  border: 1px solid #d3e1dc;
  border-radius: 8px;
  background: #edf5f1;
}
#editor-canvas {
  display: block;
  width: 100%;
  height: clamp(250px, 45vw, 485px);
  touch-action: none;
  cursor: grab;
}
#editor-canvas:active { cursor: grabbing; }
#editor-canvas.has-overflow-tray { min-height: 340px; }
#editor-canvas:focus-visible { outline-offset: -3px; }
.editor-selection { margin: 8px 1px 0; color: var(--soft-ink); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.editor-selection:empty, .editor-status:empty { display: none; }
.editor-status { margin-top: 7px; overflow-wrap: anywhere; }
.result-editor:fullscreen { padding: 16px; overflow: auto; border-radius: 0; }
.result-editor:fullscreen #editor-canvas { height: max(300px, calc(100dvh - 190px)); }

@media (max-width: 620px) {
  .editor-tools, .editor-actions { gap: 5px; }
  .editor-actions { flex: 1 1 100%; }
  .editor-tools button, .editor-tools select, .editor-tools input:not([type="checkbox"]) { min-height: 36px; }
  #editor-canvas { height: clamp(315px, 80vw, 485px); }
  #editor-canvas.has-overflow-tray { height: clamp(395px, calc(80vw + 80px), 565px); }
}

@media (min-width: 901px) {
  .planner-grid:has(#result-editor:not([hidden])) .result-card { grid-column: 1 / -1; grid-row: 1; }
}

.result-summary { color: var(--soft-ink); font-size: 12px; line-height: 1.5; }
.result-summary:not(:empty) { margin-top: 16px; }
.result-summary h3 { margin-bottom: 7px; color: var(--ink); font-size: 14px; font-weight: 720; }
.result-summary p + p { margin-top: 5px; }
.result-summary ul { margin: 5px 0 8px; padding-left: 18px; }
.result-summary .table-wrap, .directory-list .table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 10px; font-weight: 710; }
td { color: var(--soft-ink); font-variant-numeric: tabular-nums; }
td:first-child { color: var(--ink); font-weight: 680; }
tbody tr:last-child td { border-bottom: 0; }
td button { white-space: nowrap; }

.directory-note {
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid #dfece6;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.5;
}
.products-directory-header { flex-wrap: wrap; }
.directory-product-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.product-name-field { grid-column: 1 / -1; }
.product-group-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.product-group-status { margin: 0 0 12px; overflow-wrap: anywhere; }
.directory-product-group + .directory-product-group { margin-top: 12px; }
.directory-item-group {
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--pine-light);
  color: var(--pine-dark);
  font-size: 12px;
  font-weight: 720;
  overflow-wrap: anywhere;
}
.directory-list { max-width: 100%; overflow-x: auto; }
.directory-list > p { color: var(--muted); font-size: 13px; }
.directory-list .directory-item, .directory-list .list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.directory-list .directory-item:last-child, .directory-list .list-item:last-child { border-bottom: 0; }
.directory-item strong, .list-item strong { display: block; color: var(--ink); font-size: 13px; }
.directory-item small, .list-item small { color: var(--muted); font-size: 11px; }
.directory-list .button { min-height: 30px; padding: 4px 8px; font-size: 11px; }
.directory-list .row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.directory-list .button-danger { color: var(--danger); }
.directory-form { display: grid; gap: 13px; }
.directory-form .form-status { margin-top: 0; }
.fieldset { min-width: 0; margin: 0; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 8px; }
.fieldset legend { padding: 0 4px; color: var(--soft-ink); font-size: 12px; font-weight: 700; }
.fieldset legend + .field-hint { margin-top: 0; }
.pallet-custom { margin-top: 9px; }
.product-box-properties { margin-top: 9px; }
.product-pallet-properties { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.product-package-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.product-package-totals > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.product-package-totals dt { color: var(--muted); font-size: 11px; font-weight: 680; line-height: 1.35; }
.product-package-totals dd {
  margin: 0;
  color: var(--pine-dark);
  font-size: 16px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (max-width: 475px) {
  .product-pallet-properties { grid-template-columns: minmax(0, 1fr); }
}

.product-preview {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}
.product-preview h3 { margin: 0 0 7px; color: var(--ink); font-size: 13px; font-weight: 720; line-height: 1.35; }
.product-preview-stage {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e0ebe7;
  border-radius: 7px;
  background-color: #eef6f2;
  background-image: radial-gradient(#d9e8e1 1px, transparent 1px);
  background-size: 13px 13px;
}
#product-preview-canvas { display: block; width: 100%; height: clamp(145px, 17vw, 185px); }
#product-preview-empty {
  display: grid;
  place-content: center;
  min-height: 58px;
  padding: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
}
.product-preview-details { color: var(--soft-ink); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.product-preview-size { margin: 7px 1px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.product-preview-overhang { margin: 4px 1px 0; }
.product-preview-details p:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.client-product-options {
  display: grid;
  gap: 5px;
  max-height: 250px;
  margin-top: 9px;
  overflow: auto;
}
.client-product-row, .client-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.client-product-row:last-child, .client-link-row:last-child { border-bottom: 0; }
.client-product-row input:not([type="checkbox"]), .client-link-row input:not([type="checkbox"]) { min-height: 32px; padding: 6px; font-size: 11px; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .planner-grid, .directory-grid { gap: 13px; }
  .planner-grid { grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr); }
  .main { padding-inline: 19px; }
  .order-lines-labels, .order-line { grid-template-columns: 17px minmax(80px, 1fr) minmax(108px, 122px) 66px; gap: 5px; }
  .line-actions { gap: 0; }
  .icon-button { flex-basis: 22px; width: 22px; }
  .print-button { flex-basis: 34px; width: 34px; }
}

@media (max-width: 900px) {
  .planner-grid, .directory-grid { grid-template-columns: minmax(0, 1fr); }
  .main { padding-inline: 23px; }
  .card { padding: 20px; }
  .metric strong { font-size: 21px; }
  .directory-form-card { grid-row: 1; }
}

@media (max-width: 620px) {
  .app-shell { display: block; }
  .sidebar { position: static; min-height: auto; padding: 12px 11px 6px; }
  .brand { padding-left: 4px; }
  .brand-symbol { flex-basis: 30px; width: 30px; height: 30px; border-radius: 8px; }
  .brand-text { font-size: 16px; }
  .brand-text span, .nav-caption { display: none; }
  .nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; margin-top: 9px; }
  .account-summary { margin: 8px 0 0; padding: 6px 4px 2px; }
  .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 46px;
    margin: 0;
    padding: 3px 2px;
    text-align: center;
    font-size: 10px;
    line-height: 1.2;
  }
  .nav-link .icon { width: 15px; height: 15px; }
  .main { padding: 20px 11px 23px; }
  .page-header { margin-bottom: 14px; }
  .page-header p { margin-top: 6px; font-size: 12px; }
  .card { padding: 13px; border-radius: 12px; }
  .card-header { margin-bottom: 14px; }
  .card-header h2 { font-size: 19px; }
  .metrics { gap: 4px; margin-bottom: 10px; }
  .metric { min-height: 51px; padding: 5px; }
  .metric strong { font-size: 16px; }
  .metric-label { font-size: 9px; }
  .result-canvas-shell { padding: 6px; }
  .result-empty { min-height: 140px; }
  .field-grid { gap: 8px; }
}

@media (min-width: 1160px) {
  .result-card:has(#result-editor:not([hidden])) .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 475px) {
  .save-project-form { grid-template-columns: minmax(0, 1fr); }
  .order-lines-labels, .order-line { grid-template-columns: 17px minmax(0, 1fr) 66px; }
  .order-quantity-heading { display: none; }
  .line-actions { grid-column: 3; grid-row: 1; }
  .line-quantity {
    display: grid;
    grid-column: 2 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(108px, 138px);
    align-items: center;
    gap: 5px;
  }
  .line-quantity-label {
    display: block;
    color: var(--soft-ink);
    font-size: 11px;
    font-weight: 660;
  }
  .line-quantity-controls { grid-template-columns: 33px minmax(0, 1fr) 33px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

.mixed-stack-list {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--soft-ink);
  font-size: 12px;
}
.mixed-stack-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 7px;
  overflow-wrap: anywhere;
}
.mixed-stack-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: #674729;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.mixed-stack-marker { pointer-events: none; }
.print-load-plan { display: none; }

@media print {
  :root, body, .main { background: #fff; color: #000; }
  .app-shell, .planner-grid { display: block; }
  .sidebar, .order-card, .print-button, .result-view-toggle, .editor-tools, .editor-help, .save-project-form { display: none !important; }
  .main { padding: 0; }
  .result-card { border: 0; box-shadow: none; }
  .result-canvas-shell, .metric { print-color-adjust: exact; }
  .result-layout svg { max-height: none; }
  .layout-diagram-scroll { overflow: visible; }
  .layout-diagram-scroll.is-layered svg { min-width: 0; }
  .layout-diagram-scroll.has-layout-groups svg { min-width: 0; }
  .result-editor { display: none !important; }
  .result-card:has(.print-load-plan:not(:empty)) .result-canvas-shell,
  .result-card:has(.print-load-plan:not(:empty)) #result-truck-name { display: none; }
  .print-load-plan:not(:empty) { display: block; }
  .print-vehicle-plan { margin: 12px 0 16px; }
  .print-vehicle-plan h3 { margin: 0 0 5px; break-after: avoid-page; }
  .print-vehicle-plan > svg { width: 100%; height: auto; break-inside: avoid; print-color-adjust: exact; }
  .mixed-stack-print-caption { margin: 4px 0 0; font-size: 12px; font-weight: 700; break-after: avoid-page; }
  .mixed-stack-list li { break-inside: avoid; print-color-adjust: exact; }
}

.layout-controls { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.result-layout [data-plan-item-id]:focus-visible { outline: 2px solid var(--pine-dark); outline-offset: 1px; }

.layout-layer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
  padding: 3px;
  border: 1px solid #c9dbd5;
  border-radius: 7px;
  background: #eaf3ef;
}
.result-vehicles .layout-layer-tabs button {
  min-height: 24px;
  border-color: transparent;
  border-radius: 4px;
  white-space: nowrap;
}
.result-vehicles .layout-layer-tabs button[aria-pressed="false"] { background: transparent; }
.result-vehicles button:hover[aria-pressed="false"] { border-color: #95b8ac; }
.result-layout [data-plan-item-id] { cursor: grab; touch-action: pinch-zoom; user-select: none; }
.result-layout [data-plan-item-id] > rect:first-of-type { pointer-events: all; }
.result-layout [data-plan-item-id].is-selected > rect:first-of-type,
.result-layout [data-plan-item-id]:hover > rect:first-of-type { stroke-width: 2.4; }
.result-layout .is-plan-dragging [data-plan-item-id] { cursor: grabbing; }
.result-layout .is-plan-drag-preview { opacity: .7; }
.layout-plan-ground-surface {
  fill: #f2f7f5;
  stroke: #9ebbb1;
  stroke-dasharray: 4 3;
}
.layout-plan-ground-surface.is-plan-ground-target {
  fill: #dcefe7;
  stroke: #287965;
  stroke-width: 2;
}
.layout-plan-ground-title { fill: #294e46; font-size: 13px; font-weight: 700; }
.layout-plan-ground-empty { fill: #526c67; font-size: 11px; }
.layout-plan-ground-section-title { fill: #294e46; font-size: 11px; font-weight: 700; }
.layout-plan-ground-overflow .layout-plan-ground-section-title { fill: #6c4d16; }
.layout-plan-ground-overflow .layout-plan-ground-item > rect { stroke-dasharray: 4 2; }
.layout-plan-ground-tier { fill: #294e46; font-size: 10px; font-weight: 750; }
.layout-ground-return-preview { opacity: .72; pointer-events: none; stroke-dasharray: 3 2; stroke-width: 1.6; }
.layout-ground-return-preview[data-valid="false"] { fill: #f4d9d9; stroke: var(--danger); }
.is-plan-return-support { fill: rgb(188 229 206 / 48%); stroke: #287965; stroke-width: 2; pointer-events: none; }
.layout-return-options { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; width: 100%; padding: 0 5px 6px; }
.layout-return-options .field-hint { margin: 0; }
.layout-detail {
  justify-self: stretch;
  margin: 2px 0 6px;
  padding: 4px 5px;
  color: var(--soft-ink);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.layout-detail.is-plan-error { color: var(--danger); }
.result-warnings { margin: 5px 0 0; padding-inline-start: 19px; }
.result-warnings li + li { margin-top: 3px; }
.result-table-wrap { overflow-x: auto; }
.result-cell-area { display: block; color: var(--muted); font-size: 11px; }
.result-table-wrap + h3 { margin-top: 12px; }
.result-table td:first-child { overflow-wrap: anywhere; }
.result-table th:not(:first-child), .result-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.result-table .order-group-result th { color: var(--soft-ink); background: var(--surface-soft); font-size: 11px; overflow-wrap: anywhere; }
.directory-item-content { display: grid; flex: 1; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.directory-item-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 4px 9px; }
.directory-item-actions .text-button { padding-inline: 0; font-size: 11px; }
.directory-item-actions .delete-button { color: var(--danger); }
.directory-empty { padding: 8px 0; }
input:not([type="checkbox"]):disabled { color: #687d77; border-color: #e1e9e5; background: #f5f8f6; }

@media (max-width: 620px) {
  .directory-item-actions { flex-direction: column; align-items: flex-end; gap: 2px; }
}

#metric-weight, #metric-cargo-area { font-size: clamp(12px, 1.4vw, 19px); }
.result-canvas-shell.is-stale .layout-svg { opacity: .65; }

#project-info { width: min(94vw, 660px); max-height: 85vh; overflow: auto; padding: 1.25rem; }
#project-info::backdrop { background: rgb(0 0 0 / 45%); }
#project-info-content { margin: 0.75rem 0; }
#project-info-content .checkbox-field { display: flex; padding: 0.25rem 0; }
#team-nav[hidden], #change-password-open[hidden], #team-secret-label[hidden],
#save-project-copy-control[hidden], .login-form[hidden] { display: none; }
