/* Authoritative Tetris workbench layer. Keep planner layout changes here. */
body[data-active-view="workspace"] {
  --planner-bg: #edf3f9;
  --planner-surface: #ffffff;
  --planner-surface-soft: #f6f9fc;
  --planner-ink: #10233d;
  --planner-muted: #5f728c;
  --planner-line: #cbd8e7;
  --planner-line-soft: #e2eaf3;
  --planner-accent: #1769e9;
  --planner-accent-strong: #0f58ca;
  --planner-danger: #bd2c38;
  --planner-danger-soft: #fff3f4;
}

body[data-theme="dark"][data-active-view="workspace"] {
  --planner-bg: #101a28;
  --planner-surface: #172436;
  --planner-surface-soft: #1c2c40;
  --planner-ink: #edf5ff;
  --planner-muted: #a8b9ce;
  --planner-line: #344a64;
  --planner-line-soft: #293d55;
  --planner-accent: #4d94ff;
  --planner-accent-strong: #73aaff;
  --planner-danger: #ff8d98;
  --planner-danger-soft: #3c2229;
}

body[data-active-view="workspace"],
body[data-active-view="workspace"] .app-shell,
body[data-active-view="workspace"] .app-main {
  background: var(--planner-bg) !important;
}

body[data-active-view="workspace"] #view-workspace.workspace {
  display: grid !important;
  grid-template-columns: clamp(292px, 17vw, 326px) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  height: calc(100dvh - 54px) !important;
  min-height: 620px !important;
  margin: 0 !important;
  padding: 8px !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--planner-bg) !important;
  box-shadow: none !important;
  color: var(--planner-ink);
  font-family: Manrope, "Segoe UI", sans-serif;
}

body[data-active-view="workspace"] #view-workspace .workspace__panel,
body[data-active-view="workspace"] #view-workspace .workspace__canvas {
  min-width: 0 !important;
  min-height: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .workspace__panel {
  height: 100% !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 12px !important;
  background: var(--planner-surface) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .panel-header {
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 12px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--planner-line) !important;
  background: var(--planner-surface) !important;
}

body[data-active-view="workspace"] #view-workspace .panel-header__titleline,
body[data-active-view="workspace"] #view-workspace .canvas-header__titleline {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0;
}

body[data-active-view="workspace"] #view-workspace .panel-header h2,
body[data-active-view="workspace"] #view-workspace .canvas-header h2 {
  margin: 0 !important;
  overflow: visible !important;
  color: var(--planner-ink) !important;
  font-size: 17px !important;
  font-weight: 820 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.015em !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
}

body[data-active-view="workspace"] #view-workspace .panel-help {
  flex: 0 0 22px !important;
  width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  padding: 0 !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 50% !important;
  background: var(--planner-surface-soft) !important;
  color: var(--planner-muted) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner > .panel-scroll {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 10px 10px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

body[data-active-view="workspace"] #view-workspace .planner-control-section,
body[data-active-view="workspace"] #view-workspace .planner-param-group {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 10px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--planner-line-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-param-groups {
  display: contents !important;
}

body[data-active-view="workspace"] #view-workspace .planner-section-heading,
body[data-active-view="workspace"] #view-workspace .planner-param-group legend {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  width: 100% !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
  color: var(--planner-ink) !important;
  font-size: 11px !important;
  font-weight: 820 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-section-heading small,
body[data-active-view="workspace"] #view-workspace .planner-param-group legend small {
  min-width: 0;
  overflow: hidden;
  color: var(--planner-muted) !important;
  font-size: 9px !important;
  font-weight: 650 !important;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body[data-active-view="workspace"] #view-workspace .planner-param-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
}

body[data-active-view="workspace"] #view-workspace .field,
body[data-active-view="workspace"] #view-workspace .field label {
  min-width: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .field label {
  display: grid !important;
  gap: 4px !important;
  color: var(--planner-muted) !important;
  font-size: 9px !important;
  font-weight: 780 !important;
  line-height: 1.1 !important;
  letter-spacing: 0.035em !important;
  text-transform: uppercase !important;
}

body[data-active-view="workspace"] #view-workspace .field__input-wrap {
  display: block !important;
}

body[data-active-view="workspace"] #view-workspace .field-stepper {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner .field input[type="number"] {
  width: 100% !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 9px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 7px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-ink) !important;
  font-size: 14px !important;
  font-weight: 780 !important;
  font-variant-numeric: tabular-nums;
  line-height: 1 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner .field input[type="number"]:hover {
  border-color: #9eb2ca !important;
}

body[data-active-view="workspace"] #view-workspace .field input[type="number"]:focus-visible,
body[data-active-view="workspace"] #view-workspace button:focus-visible,
body[data-active-view="workspace"] #view-workspace a:focus-visible {
  outline: 2px solid var(--planner-accent) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-zone-footer {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .zone-switch,
body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions {
  display: flex !important;
  gap: 5px !important;
  min-width: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .zone-btn,
body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  min-height: 34px !important;
  margin: 0 !important;
  padding: 0 9px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 7px !important;
  background: var(--planner-surface-soft) !important;
  color: var(--planner-ink) !important;
  font-size: 11px !important;
  font-weight: 790 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .zone-btn {
  flex: 1 1 0 !important;
  min-width: 34px !important;
}

body[data-active-view="workspace"] #view-workspace .zone-btn.is-active {
  border-color: var(--planner-accent) !important;
  background: #eaf2ff !important;
  color: var(--planner-accent-strong) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .zone-btn.is-active {
  background: #1e3f6d !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action {
  width: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  font-size: 16px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-preset-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-preset-grid button {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 6px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 7px !important;
  background: var(--planner-surface-soft) !important;
  color: var(--planner-ink) !important;
  font-size: 10px !important;
  font-weight: 780 !important;
  font-variant-numeric: tabular-nums;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-preset-grid button:hover,
body[data-active-view="workspace"] #view-workspace .zone-btn:hover,
body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action:hover {
  border-color: var(--planner-accent) !important;
  color: var(--planner-accent-strong) !important;
}

body[data-active-view="workspace"] #view-workspace .panel-actions--planner {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 10px 0 !important;
  border-bottom: 1px solid var(--planner-line-soft) !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner .panel-actions--planner > button {
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 10px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 7px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-ink) !important;
  font-size: 11px !important;
  font-weight: 790 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner .panel-actions--planner > .planner-action--add {
  grid-column: 1 / -1 !important;
  border-color: var(--planner-accent) !important;
  background: var(--planner-accent) !important;
  color: #fff !important;
}

body[data-active-view="workspace"] #view-workspace .panel-card--planner .panel-actions--planner > .danger {
  border-color: #efc0c5 !important;
  background: var(--planner-danger-soft) !important;
  color: var(--planner-danger) !important;
}

body[data-active-view="workspace"] #view-workspace #rotateBtn,
body[data-active-view="workspace"] #view-workspace #deleteSelectedBtn {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metrics {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0 !important;
  width: 100% !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: var(--planner-surface-soft) !important;
  grid-auto-rows: 52px !important;
  height: auto !important;
  align-content: start !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric {
  display: grid !important;
  align-content: center !important;
  gap: 2px !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 7px 9px !important;
  border: 0 !important;
  border-right: 1px solid var(--planner-line-soft) !important;
  border-bottom: 1px solid var(--planner-line-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric:nth-child(2n) {
  border-right: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric:nth-last-child(-n + 2) {
  border-bottom: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric__label {
  color: var(--planner-muted) !important;
  font-size: 9px !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  letter-spacing: 0.035em !important;
  text-transform: uppercase !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric__value {
  color: var(--planner-ink) !important;
  font-size: 17px !important;
  font-weight: 840 !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.08 !important;
  letter-spacing: -0.02em !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-metric__subvalue {
  overflow: hidden;
  color: var(--planner-muted) !important;
  font-size: 8px !important;
  font-weight: 650 !important;
  line-height: 1.1 !important;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body[data-active-view="workspace"] #view-workspace .planner-secondary-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 6px !important;
  padding-top: 10px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-secondary-actions button {
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 10px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 7px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-ink) !important;
  font-size: 10px !important;
  font-weight: 760 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-secondary-actions .canvas-reset-btn {
  border-color: #efc0c5 !important;
  background: var(--planner-danger-soft) !important;
  color: var(--planner-danger) !important;
}

body[data-active-view="workspace"] #view-workspace .workspace__canvas {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  height: 100% !important;
  overflow: hidden !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 12px !important;
  background: var(--planner-surface) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-height: 50px !important;
  margin: 0 !important;
  padding: 7px 10px 7px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--planner-line) !important;
  border-radius: 0 !important;
  background: var(--planner-surface) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header h2 {
  font-size: 17px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch {
  display: inline-flex !important;
  height: 34px !important;
  padding: 2px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: var(--planner-surface-soft) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button {
  height: 28px !important;
  min-height: 28px !important;
  min-width: 55px !important;
  padding: 0 9px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--planner-muted) !important;
  font-size: 11px !important;
  font-weight: 780 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button.is-active {
  background: var(--planner-surface) !important;
  color: var(--planner-accent-strong) !important;
  box-shadow: 0 1px 3px rgba(26, 59, 99, 0.16) !important;
}

body[data-active-view="workspace"] #view-workspace .planner-export-actions {
  display: flex !important;
  gap: 5px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-export-button,
body[data-active-view="workspace"] #view-workspace .planner-export-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  min-width: 48px !important;
  padding: 0 10px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-accent-strong) !important;
  font-size: 10px !important;
  font-weight: 820 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-export-link[hidden] {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-board {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #e8eef6 !important;
  box-shadow: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-board {
  background: #111d2b !important;
}

body[data-active-view="workspace"] #view-workspace #stage,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage {
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 8px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame,
body[data-active-view="workspace"] #view-workspace .planner-3d {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  border-radius: 9px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d {
  inset: auto !important;
  border: 1px solid var(--planner-line) !important;
  background: #f4f8fc !important;
  box-shadow: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-3d {
  background: #142235 !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__canvas {
  cursor: grab;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__canvas[data-drag-mode="pallet"] {
  cursor: grabbing;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__hud {
  top: 12px !important;
  left: 12px !important;
  max-width: min(620px, calc(100% - 180px)) !important;
  min-height: 36px !important;
  padding: 0 11px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: var(--planner-ink) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-3d__hud {
  background: rgba(23, 36, 54, 0.96) !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__toolbar {
  top: 12px !important;
  right: 12px !important;
  height: 36px !important;
  padding: 2px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: var(--planner-surface) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__tool {
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--planner-ink) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__tool:hover {
  background: var(--planner-surface-soft) !important;
  color: var(--planner-accent-strong) !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__empty {
  top: 58px !important;
  left: 12px !important;
  align-items: flex-start !important;
  width: min(330px, calc(100% - 178px)) !important;
  padding: 9px 11px !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: var(--planner-muted) !important;
  text-align: left !important;
  transform: none !important;
  gap: 2px !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__empty strong {
  color: var(--planner-ink) !important;
  font-size: 13px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__empty span:last-child {
  font-size: 10px !important;
  line-height: 1.25 !important;
}

body[data-active-view="workspace"] #view-workspace .planner-3d__empty-cube {
  display: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-3d__empty {
  background: rgba(23, 36, 54, 0.96) !important;
}

/* Pallet palette: the letter is the sole source of the pallet color. */
body[data-active-view="workspace"] #view-workspace .pallet {
  --pallet-fill-top: #d7e9fb;
  --pallet-fill-bottom: #abcff2;
  --pallet-edge: #2f6fab;
  --pallet-ink: #12385e;
  --pallet-overlay: linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 58%);
  isolation: isolate;
  border: 2px solid var(--pallet-edge) !important;
  border-radius: 8px !important;
  background: linear-gradient(145deg, var(--pallet-fill-top), var(--pallet-fill-bottom)) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62) !important;
}

body[data-active-view="workspace"] #view-workspace .pallet::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: var(--pallet-overlay);
  pointer-events: none;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="A"] {
  --pallet-fill-top: #d7e9fb;
  --pallet-fill-bottom: #abcff2;
  --pallet-edge: #2f6fab;
  --pallet-ink: #12385e;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="B"] {
  --pallet-fill-top: #d9efe5;
  --pallet-fill-bottom: #a9d8c2;
  --pallet-edge: #2b7c60;
  --pallet-ink: #154433;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="C"] {
  --pallet-fill-top: #fff0c8;
  --pallet-fill-bottom: #f3ca78;
  --pallet-edge: #a36510;
  --pallet-ink: #543203;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="D"] {
  --pallet-fill-top: #ffe0df;
  --pallet-fill-bottom: #f2aaa8;
  --pallet-edge: #a74448;
  --pallet-ink: #551c20;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="E"] {
  --pallet-fill-top: #eadffd;
  --pallet-fill-bottom: #c9b3ef;
  --pallet-edge: #6c50a8;
  --pallet-ink: #322058;
}

body[data-active-view="workspace"] #view-workspace .pallet .color-index {
  position: absolute !important;
  z-index: 2 !important;
  inset: 50% auto auto 50% !important;
  display: grid !important;
  place-items: center !important;
  width: 42px !important;
  height: 34px !important;
  border: 1px solid var(--pallet-edge) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--pallet-ink) !important;
  font-size: 18px !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  opacity: 1 !important;
  text-shadow: none !important;
  transform: translate(-50%, -50%) !important;
  -webkit-text-stroke: 0 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .pallet .size,
body[data-active-view="workspace"] #view-workspace .pallet .weight,
body[data-active-view="workspace"] #view-workspace .pallet .pallet-stack-badge {
  z-index: 2 !important;
  padding: 4px 7px !important;
  border: 1px solid rgba(36, 64, 96, 0.18) !important;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.84) !important;
  color: #1c314a !important;
  font-size: 11px !important;
  font-weight: 720 !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .pallet.last {
  border-color: #0d5ecb !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 0 2px #0d5ecb !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="A"] {
  --pallet-fill-top: #315d8d;
  --pallet-fill-bottom: #1c426b;
  --pallet-edge: #78b4f0;
  --pallet-ink: #dcebff;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="B"] {
  --pallet-fill-top: #2f7058;
  --pallet-fill-bottom: #1d503e;
  --pallet-edge: #72d0aa;
  --pallet-ink: #e2fff2;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="C"] {
  --pallet-fill-top: #805b1f;
  --pallet-fill-bottom: #5c3d10;
  --pallet-edge: #f1c66e;
  --pallet-ink: #fff2ce;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="D"] {
  --pallet-fill-top: #85464b;
  --pallet-fill-bottom: #623035;
  --pallet-edge: #f29ca0;
  --pallet-ink: #ffe8e9;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="E"] {
  --pallet-fill-top: #654d92;
  --pallet-fill-bottom: #48346f;
  --pallet-edge: #c1a6f4;
  --pallet-ink: #f2ebff;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .color-index,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .size,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .weight,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .pallet-stack-badge {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: rgba(10, 22, 35, 0.8) !important;
  color: var(--pallet-ink) !important;
}

body[data-active-view="workspace"] #view-workspace .planner-param-grid--truck,
body[data-active-view="workspace"] #view-workspace .planner-param-grid--pallet {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  grid-template-columns: auto minmax(420px, 1fr) auto auto !important;
  min-height: 58px !important;
  gap: 12px !important;
  padding: 8px 10px 8px 14px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__titleblock {
  min-width: 142px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  justify-self: stretch !important;
  gap: 9px !important;
  min-width: 0 !important;
  max-width: 780px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics-title {
  display: inline-flex !important;
  align-items: center !important;
  height: 28px !important;
  padding: 0 9px !important;
  border: 1px solid rgba(191, 207, 228, 0.95) !important;
  border-radius: 999px !important;
  background: #f7faff !important;
  color: #4f6683 !important;
  font-size: 10px !important;
  font-weight: 820 !important;
  letter-spacing: 0.055em !important;
  line-height: 1 !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  display: grid !important;
  grid-template-columns: minmax(70px, 0.72fr) minmax(132px, 1.28fr) minmax(78px, 0.78fr) minmax(150px, 1.38fr) !important;
  gap: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 38px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid rgba(191, 207, 228, 0.95) !important;
  border-radius: 11px !important;
  background: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  display: grid !important;
  align-content: center !important;
  gap: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 5px 10px !important;
  border: 0 !important;
  border-right: 1px solid rgba(226, 234, 243, 0.95) !important;
  border-radius: 0 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:last-child {
  border-right: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label {
  color: #71839d !important;
  font-size: 8px !important;
  font-weight: 760 !important;
  letter-spacing: 0.055em !important;
  line-height: 1 !important;
  text-transform: uppercase !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__value {
  overflow: hidden !important;
  color: #10233d !important;
  font-size: 14px !important;
  font-weight: 860 !important;
  letter-spacing: -0.015em !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__subvalue {
  overflow: hidden !important;
  color: #5f728c !important;
  font-size: 8px !important;
  font-weight: 680 !important;
  line-height: 1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .is-overweight,
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .warn {
  color: #bd2c38 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics-title {
  border-color: rgba(91, 126, 170, 0.58) !important;
  background: #142235 !important;
  color: #a8bdd8 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  border-color: rgba(91, 126, 170, 0.58) !important;
  background: #101d2f !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  border-right-color: rgba(52, 74, 100, 0.72) !important;
  background: linear-gradient(180deg, #172436 0%, #132035 100%) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__subvalue {
  color: #a8b9ce !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__value {
  color: #edf5ff !important;
}

@media (max-width: 1240px) and (min-width: 961px) {
  body[data-active-view="workspace"] #view-workspace.workspace {
    grid-template-columns: 286px minmax(0, 1fr) !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-section-heading small,
  body[data-active-view="workspace"] #view-workspace .planner-param-group legend small {
    max-width: 116px;
  }
}

@media (max-width: 960px) {
  body[data-active-view="workspace"] #view-workspace.workspace {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px !important;
    overflow: visible !important;
  }

  body[data-active-view="workspace"] #view-workspace .workspace__canvas {
    order: 1;
    height: min(68dvh, 640px) !important;
    min-height: 430px !important;
  }

  body[data-active-view="workspace"] #view-workspace .workspace__panel {
    order: 2;
    height: auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-card--planner,
  body[data-active-view="workspace"] #view-workspace .panel-scroll {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-scroll {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 18px !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-secondary-actions {
    align-self: end;
    padding-bottom: 12px !important;
  }
}

@media (max-width: 640px) {
  body[data-active-view="workspace"] #view-workspace .workspace__canvas {
    min-height: 390px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics-title {
    display: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    height: auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
    height: 36px !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-export-actions {
    grid-column: 2 !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-view-switch {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-view-switch__button {
    flex: 1 1 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-scroll {
    display: flex !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-3d__hint {
    display: none !important;
  }
}

/* Instrument strip: compact operational metrics without the spreadsheet look. */
body[data-active-view="workspace"] #view-workspace .canvas-header,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  grid-template-columns: minmax(145px, auto) minmax(460px, 1fr) auto auto !important;
  min-height: 62px !important;
  gap: 10px !important;
  padding: 9px 10px 9px 16px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__titleblock {
  min-width: 145px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
  max-width: 760px !important;
  overflow: visible !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  display: grid !important;
  grid-template-columns: minmax(100px, 0.76fr) minmax(145px, 1.16fr) minmax(105px, 0.82fr) minmax(155px, 1.26fr) !important;
  grid-template-rows: 40px !important;
  gap: 6px !important;
  height: 40px !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: 1fr !important;
  align-items: center !important;
  align-content: center !important;
  column-gap: 8px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 11px !important;
  overflow: hidden !important;
  border: 1px solid #dce5ef !important;
  border-radius: 9px !important;
  background: #f5f8fc !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #657a94 !important;
  font-size: 9px !important;
  font-weight: 760 !important;
  letter-spacing: 0.045em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #4b86d8;
  box-shadow: 0 0 0 3px rgba(75, 134, 216, 0.1);
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(2) .canvas-metric__label::before {
  background: #16836d;
  box-shadow: 0 0 0 3px rgba(22, 131, 109, 0.1);
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(3) .canvas-metric__label::before {
  background: #d28a19;
  box-shadow: 0 0 0 3px rgba(210, 138, 25, 0.1);
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(4) .canvas-metric__label::before {
  background: #60708a;
  box-shadow: 0 0 0 3px rgba(96, 112, 138, 0.1);
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__value {
  justify-self: end !important;
  min-width: 0 !important;
  color: #12263f !important;
  font-size: 13px !important;
  font-weight: 820 !important;
  letter-spacing: -0.01em !important;
  line-height: 1 !important;
  text-align: right !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__subvalue {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch {
  height: 36px !important;
  padding: 3px !important;
  border-color: #d7e1ec !important;
  border-radius: 9px !important;
  background: #f1f5f9 !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button {
  height: 28px !important;
  border-radius: 6px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button.is-active {
  background: #ffffff !important;
  color: #1769c2 !important;
  box-shadow: 0 1px 3px rgba(25, 64, 109, 0.16), inset 0 0 0 1px rgba(197, 215, 235, 0.82) !important;
}

body[data-active-view="workspace"] #view-workspace .planner-export-button,
body[data-active-view="workspace"] #view-workspace .planner-export-link {
  height: 36px !important;
  border-color: #d7e1ec !important;
  border-radius: 9px !important;
  background: #ffffff !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header {
  background: linear-gradient(180deg, #152235 0%, #111e30 100%) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  border-color: #34475f !important;
  background: #19283b !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label {
  color: #9eb0c6 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__value {
  color: #f2f7fd !important;
}

@media (max-width: 960px) and (min-width: 641px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    grid-template-columns: minmax(135px, auto) minmax(300px, 1fr) auto auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(4, minmax(78px, 1fr)) !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: center !important;
    gap: 2px !important;
    padding: 5px 7px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label::before {
    display: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__value {
    justify-self: center !important;
  }
}

@media (max-width: 640px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    min-height: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, 36px) !important;
    gap: 5px !important;
    height: 77px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
    grid-template-columns: auto minmax(0, 1fr) !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 9px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__label::before {
    width: 5px;
    height: 5px;
    flex-basis: 5px;
    box-shadow: none;
  }
}

@media (pointer: coarse) {
  body[data-active-view="workspace"] #view-workspace .zone-btn,
  body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action,
  body[data-active-view="workspace"] #view-workspace .planner-preset-grid button,
  body[data-active-view="workspace"] #view-workspace .panel-actions--planner button,
  body[data-active-view="workspace"] #view-workspace .planner-secondary-actions button,
  body[data-active-view="workspace"] #view-workspace .planner-view-switch__button,
  body[data-active-view="workspace"] #view-workspace .planner-export-button,
  body[data-active-view="workspace"] #view-workspace .planner-export-link,
  body[data-active-view="workspace"] #view-workspace .planner-3d__tool {
    min-height: 44px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-active-view="workspace"] #view-workspace *,
  body[data-active-view="workspace"] #view-workspace *::before,
  body[data-active-view="workspace"] #view-workspace *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Final layout authority: keep summary metrics inside the planner header. */
body[data-active-view="workspace"] #view-workspace .canvas-header,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  grid-template-columns: auto minmax(420px, 1fr) auto auto !important;
  grid-template-rows: auto !important;
  height: auto !important;
  min-height: 58px !important;
  align-items: center !important;
  overflow: hidden !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
  display: block !important;
  width: 100% !important;
  max-width: 780px !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics-title {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  grid-column: auto !important;
  grid-row: auto !important;
  height: 38px !important;
}

@media (max-width: 960px) and (min-width: 641px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    grid-template-columns: auto minmax(280px, 1fr) auto auto !important;
  }
}

@media (max-width: 640px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-rows: auto auto !important;
    gap: 7px !important;
    padding: 8px 10px !important;
    overflow: visible !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__titleblock {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-view-switch {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .planner-export-actions {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    max-width: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, 36px) !important;
    height: 72px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric__subvalue {
    display: none !important;
  }
}

/* Essential totals are the final header authority. */
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
  justify-self: start !important;
  width: min(100%, 560px) !important;
  max-width: 560px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  grid-template-columns: minmax(105px, 0.7fr) minmax(140px, 0.95fr) minmax(170px, 1.15fr) !important;
  grid-template-rows: 40px !important;
  width: 100% !important;
  max-width: 560px !important;
  height: 40px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(4),
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(5) {
  display: none !important;
}

@media (max-width: 960px) and (min-width: 641px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(3, minmax(100px, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
    width: 100% !important;
    max-width: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: 36px !important;
    max-width: none !important;
    height: 36px !important;
  }
}

/* Compact machine selector: all trucks stay reachable without a horizontal tab rail. */
body[data-active-view="workspace"] #view-workspace .planner-control-section--zones {
  position: relative !important;
  z-index: 12;
  overflow: visible !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-zone-footer {
  position: relative !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 7px !important;
  overflow: visible !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__main {
  display: grid !important;
  grid-template-columns: 32px minmax(0, 1fr) 32px !important;
  align-items: stretch !important;
  width: 100% !important;
  gap: 4px !important;
  min-width: 0 !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__step,
body[data-active-view="workspace"] #view-workspace .machine-selector__trigger {
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  border: 1px solid var(--planner-line) !important;
  border-radius: 8px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-ink) !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__step {
  width: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  font-size: 21px !important;
  font-weight: 580 !important;
  line-height: 1 !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__trigger {
  display: grid !important;
  grid-template-columns: 20px minmax(0, 1fr) 14px !important;
  align-items: center !important;
  justify-self: stretch !important;
  width: 100% !important;
  max-width: none !important;
  gap: 7px !important;
  min-width: 0 !important;
  padding: 0 9px !important;
  text-align: left !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__step:hover:not(:disabled),
body[data-active-view="workspace"] #view-workspace .machine-selector__trigger:hover,
body[data-active-view="workspace"] #view-workspace .is-picker-open .machine-selector__trigger {
  border-color: var(--planner-accent) !important;
  background: #f3f7ff !important;
  color: var(--planner-accent-strong) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .machine-selector__step:hover:not(:disabled),
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .machine-selector__trigger:hover,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .is-picker-open .machine-selector__trigger {
  background: #1e3552 !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__step:disabled {
  opacity: 0.38;
  cursor: default;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__truck {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--planner-accent);
}

body[data-active-view="workspace"] #view-workspace .machine-selector__copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__copy strong,
body[data-active-view="workspace"] #view-workspace .machine-selector__copy small {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__copy strong {
  color: var(--planner-ink);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.15;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__copy small {
  color: var(--planner-muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.1;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__chevron {
  color: var(--planner-muted);
  font-size: 16px;
  line-height: 1;
  transform: translateY(-2px);
  transition: transform 160ms ease;
}

body[data-active-view="workspace"] #view-workspace .is-picker-open .machine-selector__chevron {
  transform: translateY(2px) rotate(180deg);
}

body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions {
  align-items: stretch !important;
  gap: 4px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action {
  width: 32px !important;
  min-width: 32px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 8px !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 40;
  padding: 8px;
  border: 1px solid var(--planner-line);
  border-radius: 10px;
  background: var(--planner-surface);
  box-shadow: 0 18px 42px rgb(15 35 62 / 18%), 0 3px 10px rgb(15 35 62 / 9%);
}

body[data-active-view="workspace"] #view-workspace .zone-picker[hidden] {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 27px;
  padding: 0 3px 7px;
  border-bottom: 1px solid var(--planner-line-soft);
}

body[data-active-view="workspace"] #view-workspace .zone-picker__header strong {
  color: var(--planner-ink);
  font-size: 11px;
  font-weight: 820;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__header span {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--planner-accent-strong);
  font-size: 9px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .zone-picker__header span {
  background: #1e3f6d;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-switch {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 4px !important;
  max-height: 380px;
  margin: 7px 0 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--planner-line) transparent;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn {
  display: grid !important;
  grid-template-columns: 31px minmax(0, 1fr) 18px !important;
  align-items: center !important;
  justify-content: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 8px !important;
  border-color: transparent !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--planner-ink) !important;
  text-align: left !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn:hover,
body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn:focus-visible {
  border-color: var(--planner-line) !important;
  background: var(--planner-surface-soft) !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn.is-active {
  border-color: #b8d2fa !important;
  background: #eaf2ff !important;
  color: var(--planner-accent-strong) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .zone-picker .zone-btn.is-active {
  border-color: #315d94 !important;
  background: #1e3f6d !important;
}

body[data-active-view="workspace"] #view-workspace .zone-btn__index {
  color: var(--planner-muted);
  font-size: 8px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

body[data-active-view="workspace"] #view-workspace .zone-btn__label {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body[data-active-view="workspace"] #view-workspace .zone-btn__check {
  visibility: hidden;
  justify-self: end;
  color: var(--planner-accent);
  font-size: 12px;
  font-weight: 900;
}

body[data-active-view="workspace"] #view-workspace .zone-btn.is-active .zone-btn__check {
  visibility: visible;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn.is-editing {
  grid-template-columns: minmax(0, 1fr) !important;
  padding: 3px 6px !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn__input {
  width: 100% !important;
  min-width: 0 !important;
  height: 27px !important;
  padding: 0 7px !important;
  border: 1px solid var(--planner-accent) !important;
  border-radius: 5px !important;
  background: var(--planner-surface) !important;
  color: var(--planner-ink) !important;
  font-size: 11px !important;
  font-weight: 760 !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__hint {
  margin: 7px 2px 0;
  padding-top: 7px;
  border-top: 1px solid var(--planner-line-soft);
  color: var(--planner-muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1.25;
}

@media (pointer: coarse) {
  body[data-active-view="workspace"] #view-workspace .machine-selector__step,
  body[data-active-view="workspace"] #view-workspace .machine-selector__trigger,
  body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action,
  body[data-active-view="workspace"] #view-workspace .zone-picker .zone-btn {
    min-height: 44px !important;
  }

  body[data-active-view="workspace"] #view-workspace .machine-selector__main {
    grid-template-columns: 40px minmax(0, 1fr) 40px !important;
  }

  body[data-active-view="workspace"] #view-workspace .machine-selector__step,
  body[data-active-view="workspace"] #view-workspace .canvas-zone-footer__actions .canvas-action {
    width: 40px !important;
    min-width: 40px !important;
  }
}

/* Spatial canvas: one work surface, floating commands, no nested card stack. */
body[data-active-view="workspace"] #view-workspace .workspace__canvas {
  position: relative !important;
  display: block !important;
  isolation: isolate;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f5f8fc !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  position: absolute !important;
  top: 16px !important;
  left: 50% !important;
  z-index: 35;
  display: grid !important;
  grid-template-columns: auto minmax(280px, 1fr) auto auto !important;
  align-items: center !important;
  gap: 14px !important;
  width: min(900px, calc(100% - 180px)) !important;
  min-height: 58px !important;
  margin: 0 !important;
  padding: 8px 10px 8px 16px !important;
  overflow: visible !important;
  border: 1px solid #d6e0eb !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 16px 38px rgba(24, 51, 83, 0.12), 0 2px 7px rgba(24, 51, 83, 0.06) !important;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

body[data-active-view="workspace"] #view-workspace .canvas-header__titleblock {
  min-width: 132px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__titleline {
  gap: 7px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header h2 {
  color: #10233d !important;
  font-size: 16px !important;
  font-weight: 850 !important;
  letter-spacing: -0.025em !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header .panel-help {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  border: 0 !important;
  background: transparent !important;
  color: #7588a0 !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
  justify-self: stretch !important;
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metrics {
  grid-template-columns: minmax(82px, 0.65fr) minmax(116px, 0.9fr) minmax(145px, 1.1fr) !important;
  grid-template-rows: 40px !important;
  gap: 6px !important;
  width: 100% !important;
  max-width: none !important;
  height: 40px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 11px !important;
  border: 1px solid #dde6f0 !important;
  border-radius: 8px !important;
  background: #f7f9fc !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(4),
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric:nth-child(5) {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch {
  height: 38px !important;
  padding: 3px !important;
  border: 1px solid #d9e3ee !important;
  border-radius: 8px !important;
  background: #f1f5f9 !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button {
  height: 30px !important;
  min-height: 30px !important;
  min-width: 54px !important;
  border-radius: 6px !important;
}

body[data-active-view="workspace"] #view-workspace .planner-view-switch__button.is-active {
  background: #112842 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .planner-export-button,
body[data-active-view="workspace"] #view-workspace .planner-export-link {
  height: 38px !important;
  min-width: 52px !important;
  border-color: #d9e3ee !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #173d6d !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-board {
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f5f8fc !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace #stage,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  padding: 82px 12px 12px 8px !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.96), rgba(245, 248, 252, 0) 42%),
    #f5f8fc !important;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame {
  --ruler-top: 30px;
  --ruler-left: 48px;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: var(--ruler-top) 0 0 var(--ruler-left) !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: translateY(var(--planner-ruler-offset-y, 0px));
}

body[data-active-view="workspace"] #view-workspace .ruler-frame .ruler-corner {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame .ruler-x,
body[data-active-view="workspace"] #view-workspace .ruler-frame .ruler-y {
  color: #536a84 !important;
  background: transparent !important;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame .label {
  padding: 1px 4px !important;
  border: 0 !important;
  border-radius: 3px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  color: #3f5873 !important;
  font-size: 9px !important;
  font-weight: 720 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame .tick-x,
body[data-active-view="workspace"] #view-workspace .ruler-frame .tick-y {
  border-color: #b8c6d6 !important;
  opacity: 0.76;
}

body[data-active-view="workspace"] #view-workspace .ruler-frame .tick--major {
  border-color: #687f98 !important;
  opacity: 1;
}

body[data-active-view="workspace"] #view-workspace #bayCanvas {
  --grid-line-minor: rgba(121, 143, 168, 0.11);
  --grid-line-major: rgba(83, 107, 135, 0.14);
  position: relative !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 1px !important;
  background-color: #ffffff !important;
  outline: 1px solid rgba(133, 153, 176, 0.38);
  box-shadow: 0 12px 34px rgba(34, 61, 92, 0.07) !important;
}

body[data-active-view="workspace"] #view-workspace #bayCanvas::after {
  content: "";
  position: absolute;
  z-index: 20;
  inset: -3px;
  background:
    linear-gradient(#102b49, #102b49) 0 0 / 30px 4px no-repeat,
    linear-gradient(#102b49, #102b49) 0 0 / 4px 30px no-repeat,
    linear-gradient(#102b49, #102b49) 100% 0 / 30px 4px no-repeat,
    linear-gradient(#102b49, #102b49) 100% 0 / 4px 30px no-repeat,
    linear-gradient(#102b49, #102b49) 0 100% / 30px 4px no-repeat,
    linear-gradient(#102b49, #102b49) 0 100% / 4px 30px no-repeat,
    linear-gradient(#102b49, #102b49) 100% 100% / 30px 4px no-repeat,
    linear-gradient(#102b49, #102b49) 100% 100% / 4px 30px no-repeat;
  pointer-events: none;
}

body[data-active-view="workspace"] #view-workspace .pallet {
  --pallet-flat: #dcecff;
  --pallet-edge: #78a9e8;
  --pallet-ink: #143d70;
  isolation: isolate;
  border: 1px solid var(--pallet-edge) !important;
  border-radius: 4px !important;
  background-color: var(--pallet-flat) !important;
  background-image: none !important;
  box-shadow: 0 1px 2px rgba(27, 57, 91, 0.08) !important;
}

body[data-active-view="workspace"] #view-workspace .pallet::before {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="A"] {
  --pallet-flat: #dcecff;
  --pallet-edge: #5b96e8;
  --pallet-ink: #0f3f78;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="B"] {
  --pallet-flat: #d9f3e7;
  --pallet-edge: #44a77a;
  --pallet-ink: #14593c;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="C"] {
  --pallet-flat: #fff0cc;
  --pallet-edge: #d99525;
  --pallet-ink: #714707;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="D"] {
  --pallet-flat: #ffe0e3;
  --pallet-edge: #cf5965;
  --pallet-ink: #78212c;
}

body[data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="E"] {
  --pallet-flat: #e8e2ff;
  --pallet-edge: #8670de;
  --pallet-ink: #382a80;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="A"] {
  --pallet-flat: #315d8d;
  --pallet-edge: #78b4f0;
  --pallet-ink: #dcebff;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="B"] {
  --pallet-flat: #2f7058;
  --pallet-edge: #72d0aa;
  --pallet-ink: #e2fff2;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="C"] {
  --pallet-flat: #805b1f;
  --pallet-edge: #f1c66e;
  --pallet-ink: #fff2ce;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="D"] {
  --pallet-flat: #85464b;
  --pallet-edge: #f29ca0;
  --pallet-ink: #ffe8e9;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter="E"] {
  --pallet-flat: #654d92;
  --pallet-edge: #c1a6f4;
  --pallet-ink: #f2ebff;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet[data-pallet-letter] {
  background-color: var(--pallet-flat) !important;
  background-image: none !important;
  box-shadow: 0 1px 2px rgba(2, 8, 18, 0.22) !important;
}

body[data-active-view="workspace"] #view-workspace .pallet .color-index {
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--pallet-ink) !important;
  font-size: clamp(20px, 2vw, 32px) !important;
  font-weight: 820 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .pallet .size,
body[data-active-view="workspace"] #view-workspace .pallet .weight,
body[data-active-view="workspace"] #view-workspace .pallet .pallet-stack-badge {
  padding: 4px 7px !important;
  border: 0 !important;
  border-radius: 5px !important;
  background: rgba(255, 255, 255, 0.84) !important;
  color: #193651 !important;
  font-size: 10px !important;
  font-weight: 720 !important;
  box-shadow: none !important;
}

body[data-active-view="workspace"] #view-workspace .pallet.last {
  border-color: #0c61d3 !important;
  box-shadow: inset 0 0 0 1px #0c61d3, 0 0 0 2px rgba(12, 97, 211, 0.2) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .workspace__canvas,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-board,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace #stage {
  background: #111c2a !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace #stage {
  border: 1px solid transparent !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header {
  border-color: #344a64 !important;
  background: rgba(23, 36, 54, 0.96) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header h2 {
  color: #edf5ff !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace #bayCanvas {
  --grid-line-minor: rgba(112, 142, 177, 0.2);
  --grid-line-major: rgba(128, 158, 194, 0.34);
  background-color: #162538 !important;
  outline-color: #405a76;
}

/* Dark mode changes paint only: every elevated planner control stays on a dark surface. */
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header .panel-help {
  color: var(--planner-muted) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric {
  border-color: var(--planner-line) !important;
  background: var(--planner-surface-soft) !important;
  color: var(--planner-ink) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-view-switch {
  border-color: var(--planner-line) !important;
  background: #111d2b !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-view-switch__button {
  background: transparent !important;
  color: var(--planner-muted) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-view-switch__button:hover:not(:disabled) {
  background: var(--planner-surface-soft) !important;
  color: var(--planner-ink) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-view-switch__button.is-active {
  background: #245487 !important;
  color: #f4f8ff !important;
  box-shadow: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-export-button,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-export-link {
  border-color: var(--planner-line) !important;
  background: var(--planner-surface-soft) !important;
  color: #d8e8ff !important;
  box-shadow: none !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-export-button:hover:not(:disabled),
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-export-link:hover {
  border-color: #4d76a5 !important;
  background: #233a55 !important;
  color: #ffffff !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-export-link {
  border-color: #35684f !important;
  color: #9be4ba !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .ruler-x,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .ruler-y {
  color: #a9bdd4 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .label {
  background: #203248 !important;
  color: #e2edf9 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .tick-x,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .tick-y {
  border-color: #526d8b !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .ruler-frame .tick--major {
  border-color: #8aa4c1 !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .size,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .weight,
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .pallet .pallet-stack-badge {
  background: #132236 !important;
  color: var(--pallet-ink) !important;
}

@media (max-width: 960px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    width: calc(100% - 96px) !important;
  }

  body[data-active-view="workspace"] #view-workspace #stage,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage {
    padding: 80px 10px 12px 8px !important;
  }

}

@media (max-width: 640px) {
  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
    top: 8px !important;
    left: 8px !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-rows: auto auto !important;
    gap: 6px !important;
    width: calc(100% - 16px) !important;
    min-height: 86px !important;
    padding: 7px 8px !important;
    transform: none;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__metrics {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }

  body[data-active-view="workspace"] #view-workspace #stage,
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage {
    padding: 100px 8px 52px 8px !important;
  }

}

/* Machine-card actions: keep the closed selector focused on navigation. */
body[data-active-view="workspace"] #view-workspace .canvas-zone-footer {
  grid-template-columns: minmax(0, 1fr) !important;
}

body[data-active-view="workspace"] #view-workspace .machine-selector__fullscreen-bridge[hidden] {
  display: none !important;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__header-actions #zonePickerCount {
  margin-right: 2px;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--planner-line);
  border-radius: 7px;
  background: var(--planner-surface-soft);
  color: var(--planner-ink);
  font-size: 17px;
  font-weight: 680;
  line-height: 1;
  box-shadow: none;
}

body[data-active-view="workspace"] #view-workspace .zone-picker__action:hover:not(:disabled) {
  border-color: var(--planner-accent);
  background: #edf4ff;
  color: var(--planner-accent-strong);
}

body[data-active-view="workspace"] #view-workspace .zone-picker__action--danger:hover:not(:disabled) {
  border-color: #e3a8ae;
  background: var(--planner-danger-soft);
  color: var(--planner-danger);
}

body[data-active-view="workspace"] #view-workspace .zone-picker__action:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (pointer: coarse) {
  body[data-active-view="workspace"] #view-workspace .zone-picker__action {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
}

/* Keep the 3D work surface inside the stage and use the freed tool-rail space. */
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d {
  inset: 92px 20px 18px !important;
  width: auto !important;
  height: auto !important;
}

body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage:fullscreen .planner-3d,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage.is-stage-fullscreen .planner-3d {
  inset: 18px !important;
}

@media (max-width: 960px) {
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d {
    inset: 88px 12px 14px !important;
  }
}

@media (max-width: 640px) {
  body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d {
    inset: 104px 8px 58px !important;
  }
}

/* 2D and 3D share one stable work-surface rectangle. */
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d {
  inset:
    var(--planner-shared-view-top, 92px)
    var(--planner-shared-view-right, 20px)
    var(--planner-shared-view-bottom, 18px)
    var(--planner-shared-view-left, 20px) !important;
  border-radius: 1px !important;
}

body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage:fullscreen .planner-3d,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace #stage.is-stage-fullscreen .planner-3d {
  inset: 18px !important;
  border-radius: 9px !important;
}

/* Remaining capacity needs two rows so its long label never collides with the value. */
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric--remaining {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-content: center !important;
  gap: 2px !important;
}

body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric--remaining .canvas-metric__label,
body[data-active-view="workspace"] #view-workspace .canvas-header__metrics .canvas-metric--remaining .canvas-metric__value {
  width: 100% !important;
  text-align: left !important;
}

/* Pallet popover: label controls and direct dimension editing in one compact tool. */
.pallet-letter-menu,
body[data-theme="dark"] .pallet-letter-menu {
  width: min(360px, calc(100vw - 20px)) !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
}

.pallet-letter-menu__letters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
}

.pallet-letter-menu__letters .pallet-letter-menu__button {
  width: 100% !important;
  min-width: 0 !important;
}

.pallet-letter-menu__fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid #d8e2ef;
}

.pallet-letter-menu__field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #526782;
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
}

.pallet-letter-menu__input,
body[data-theme="dark"] .pallet-letter-menu__input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 7px;
  border: 1px solid #c8d5e5;
  border-radius: 7px;
  outline: 0;
  background: #f8fbff;
  color: #102a4a;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pallet-letter-menu__input:hover {
  border-color: #8ba6c7;
}

.pallet-letter-menu__input:focus-visible {
  border-color: #1769e9;
  box-shadow: 0 0 0 3px rgba(23, 105, 233, 0.16);
}

/* Give the 3D work surface a clear lower and right boundary. */
body[data-active-view="workspace"] #view-workspace .planner-3d::after,
body[data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 8 !important;
  pointer-events: none !important;
  border: 1px solid rgba(129, 154, 184, 0.56) !important;
  border-radius: inherit !important;
  background:
    linear-gradient(to left, rgba(38, 77, 118, 0.09), rgba(38, 77, 118, 0) 34px) right / 34px 100% no-repeat,
    linear-gradient(to top, rgba(38, 77, 118, 0.09), rgba(38, 77, 118, 0) 34px) bottom / 100% 34px no-repeat !important;
  box-shadow:
    inset -1px 0 0 rgba(57, 89, 124, 0.24),
    inset 0 -1px 0 rgba(57, 89, 124, 0.24),
    inset -16px 0 24px -26px rgba(33, 64, 100, 0.46),
    inset 0 -16px 24px -26px rgba(33, 64, 100, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.68) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .planner-3d::after,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .planner-3d::after {
  border-color: rgba(96, 128, 166, 0.48) !important;
  background:
    linear-gradient(to left, rgba(118, 162, 212, 0.11), rgba(118, 162, 212, 0) 34px) right / 34px 100% no-repeat,
    linear-gradient(to top, rgba(118, 162, 212, 0.11), rgba(118, 162, 212, 0) 34px) bottom / 100% 34px no-repeat !important;
  box-shadow:
    inset -1px 0 0 rgba(121, 163, 212, 0.22),
    inset 0 -1px 0 rgba(121, 163, 212, 0.22),
    inset -16px 0 26px -26px rgba(0, 0, 0, 0.78),
    inset 0 -16px 26px -26px rgba(0, 0, 0, 0.78),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

/* Keep the floating planner summary on the same dark surface as the rest of
   the workspace. The compact instrument-strip rule above paints it light. */
body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header {
  border-color: var(--tr-border, #2a3a4f) !important;
  background: var(--tr-surface-raised, #1b2a3d) !important;
}

body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header h2,
body[data-theme="dark"][data-active-view="workspace"][data-planner-view="3d"] #view-workspace .canvas-header h2 {
  color: var(--tr-text, #edf3fa) !important;
}
